# `BTRIM`

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

Removes specified characters from both the start and end of a string.

## Syntax

```sql
btrim(<string> [, characters])
```

## Arguments

### Required

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

### Optional

- `characters`: The characters to remove. Defaults to the space character.

## Returns

Returns a text string with specified characters removed from both ends.

## Considerations

- Removes individual characters from the set, not the string as a pattern.
- Continues removing until it encounters a character not in the set.

## Examples

### Trim Characters

Remove specified characters from both ends.

```sql
SELECT btrim('xyxtrimyyx', 'xyz') AS result;
```

Returns `'trim'`.

## Related Documentation

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