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

# String: Trim characters

> Trims characters from the left or right side of a string.

export const FormField = ({property, label, required = false, diType, uiPatterns, children}) => {
  const patterns = Array.isArray(uiPatterns) ? uiPatterns : uiPatterns ? [uiPatterns] : [];
  return <div style={{
    margin: '1.5rem 0'
  }}>
      <div style={{
    display: 'flex',
    alignItems: 'baseline',
    flexWrap: 'wrap',
    gap: '0.5rem',
    marginBottom: '0.25rem'
  }}>
        <strong>{label}</strong>
        <span style={{
    fontSize: '0.7rem',
    fontWeight: 600,
    textTransform: 'uppercase',
    letterSpacing: '0.04em',
    color: required ? '#6241f5' : '#6b7280'
  }}>
          {required ? 'Required' : 'Optional'}
        </span>
      </div>

      <div>{children}</div>

      {diType || patterns.length > 0 ? <p style={{
    fontSize: '0.85rem',
    color: '#6b7280',
    marginBottom: 0
  }}>
          {diType ? <>
              See the <a href={`/references/${diType}`}>{diType}</a> reference.{' '}
            </> : null}
          {patterns.length > 0 ? <>
              Accepts a <a href={`/documentation/placeholders-and-patterns/patterns#${patterns[0]}`}>pattern</a>.
            </> : null}
        </p> : null}
    </div>;
};

Removes unwanted characters from the start and/or end of a value. By default it strips away surrounding whitespace, which is the usual job: cleaning up stray spaces, tabs, and line breaks that slip into imported data. You can also remove specific characters of your choosing, such as trimming leading zeros or a trailing slash. Only the outer edges are touched; characters in the middle of the value are left alone.

This documentation describes: [Schema](/schemas/mapper/string-trim)

## Fields

<FormField property="side" label="Side to trim" required>
  Which edge of the value to clean up. Choose `both` to trim the start and the end, `left` for only the start, or `right` for only the end. Defaults to `both`.
</FormField>

<FormField property="characters" label="Characters to trim">
  The set of characters to remove from the chosen edge. Each character you list is treated individually, not as a phrase, so `0` trims leading and trailing zeros and `/` removes a trailing slash. Leave it empty to remove whitespace (spaces, tabs, and line breaks), which is the default.
</FormField>

## Sample data

| Field              | Value                  |
| ------------------ | ---------------------- |
| Side to trim       | `both`                 |
| Characters to trim | (empty, so whitespace) |

Input:

```json theme={null}
{ "name": "   Wool scarf   " }
```

Output:

```json theme={null}
{ "name": "Wool scarf" }
```

```json Configuration theme={null}
{
  "prototype": "string-trim",
  "parameters": {
    "side": "both"
  }
}
```
