<trim_characters> from the left, right, or both sides of the source string <expression>. If no <trim_characters> parameter is specified, the longest string containing only whitespace characters (ASCII Decimal 32) is removed. If neither LEADING, TRAILING, nor BOTH are specified, characters are removed from both sides of the specified source string <expression>.
Syntax
Parameters
| Parameter | Description | Supported input types | ||
|---|---|---|---|---|
| `LEADING | TRAILING | BOTH` | Optional. Specifies from which part or parts of the <expression> to remove the specified <trim_characters>. | If omitted, this defaults to BOTH.LEADING - trims from the beginning of the specified stringTRAILING - trims from the end of the specified string. BOTH - trims from the beginning and the end of the specified string. |
<trim_characters> | Optional. An expression that returns characters to trim from the right side of the <expression> string. If omitted, whitespace (ASCII Decimal 32) is trimmed. | TEXT | ||
<expression> | An expression that returns the string to be trimmed. | TEXT |
Return Type
TEXT
Example
The following example trims the charactersx and y from the right side of a string, since the TRAILING parameter is specified. Note that the ordering of characters in <trim_characters> is irrelevant:
TRIM, so it defaults to BOTH.
<trim_characters> parameter but specifies the TRAILING parameter, and thus trims whitespace from the right side of a string:
<trim_characters> parameter and specifies no part of the string, and thus trims whitespace from both sides of a string: