> ## Documentation Index
> Fetch the complete documentation index at: https://docs.bringits.com/llms.txt
> Use this file to discover all available pages before exploring further.

# String Manipulation

> Perform string operations on specific fields in a collection of objects

The String Manipulation command (Command Type: 1003) performs JavaScript string method operations on a specific field across all objects in a collection.

## Overview

The String Manipulation command provides functionality for:

* Applying any JavaScript string method (e.g. `toUpperCase`, `trim`, `slice`, `padStart`) to a field
* Operating across every object in the current collection
* Passing custom arguments to the string method

## Command Type

**Command Type ID:** 1003

## Parameters

| Parameter      | Type                     | Description                                                                     | Required |
| -------------- | ------------------------ | ------------------------------------------------------------------------------- | -------- |
| **key**        | string                   | Specifies the field in the object where the string manipulation will be applied | Yes      |
| **methodName** | string                   | The JavaScript string method to apply to the specified field                    | Yes      |
| **parameters** | Array of string / number | The arguments to pass to the method. Requirements depend on the method used     | Yes      |

## Usage Examples

### Convert to Uppercase

```json theme={null}
{
  "command": "string-manipulation",
  "params": {
    "key": "name",
    "methodName": "toUpperCase",
    "parameters": []
  }
}
```

### Trim Whitespace

```json theme={null}
{
  "command": "string-manipulation",
  "params": {
    "key": "title",
    "methodName": "trim",
    "parameters": []
  }
}
```

### Slice a String

```json theme={null}
{
  "command": "string-manipulation",
  "params": {
    "key": "code",
    "methodName": "slice",
    "parameters": [0, 5]
  }
}
```

### Pad a String

```json theme={null}
{
  "command": "string-manipulation",
  "params": {
    "key": "id",
    "methodName": "padStart",
    "parameters": [8, "0"]
  }
}
```

### Replace a Substring

```json theme={null}
{
  "command": "string-manipulation",
  "params": {
    "key": "description",
    "methodName": "replace",
    "parameters": ["old text", "new text"]
  }
}
```

## Common Use Cases

* **Normalization**: Trim whitespace or convert case across all records
* **Formatting**: Pad IDs or codes to a fixed length
* **Data Cleaning**: Remove or replace known bad substrings from a field

## Related Commands

* [Regex](/stream/commands/parse/regex) - Apply regex-based transformations to string fields
* [String Split](/stream/commands/parse/string-split) - Split a string field into an array
* [Key Mapping](/stream/commands/parse/key-mapping) - Rename fields after manipulation
