# `TRIM`

**Applies to:** ✅ Data 360 SQL ✅ Tableau Hyper API

Removes specified characters from the start, end, or both ends of a string.

## Syntax

```sql
trim([leading | trailing | both] [characters] from <string>)
```

## Arguments

### Required

- `<string>`: The string to trim.

### Optional

- `mode`: Where to trim from (`leading`, `trailing`, or `both`). Defaults to `both`.
- `characters`: The characters to remove. Defaults to space.

## Returns

Returns a text value with specified characters removed.

## Considerations

- Removes individual characters from the set, not the string as a pattern.
- Default behavior removes spaces from both ends.

## Examples

### Trim Characters

Remove specified characters from both ends.

```sql
SELECT trim(both 'xyz' from 'yxTomxx') AS result;
```

Returns `'Tom'`, removing all `x`, `y`, and `z` characters from both ends.

## Related Documentation

- [String Types](/docs/data/data-cloud-query-guide/references/dc-sql-reference/string.md)
