TRIM

Applies to: ✅ Data 360 SQL ✅ Tableau Hyper API

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

Syntax 

1trim([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.

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

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

Related Documentation 

DID THIS ARTICLE SOLVE YOUR ISSUE?
Let us know so we can improve!