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

# Trim

# \$trim

The `$trim` operator removes specified characters from both ends of a string.

## Input

* An array containing exactly two string values: the input string and the set of characters to trim

## Output

* The input string with specified characters removed from both ends

## Examples

### Trim Whitespace

```json theme={null}
{
  "$trim": [
    "  Hello, World!  ",
    " "
  ]
}
```

Result: `"Hello, World!"`

### Trim Specific Characters

```json theme={null}
{
  "$trim": [
    "...Hello, World!...",
    "."
  ]
}
```

Result: `"Hello, World!"`

### Field Value

```json theme={null}
{
  "$trim": [
    {
      "$input": "input_text"
    },
    " \t\n"
  ]
}
```

Result: The input\_text field with leading and trailing whitespace removed
