Skip to main content
Removes the longest string containing only characters in <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

Return Type

TEXT

Examples

The following example trims the characters x 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:

Rows: 1Execution time: 5.06ms

In the following example, no part of the string is specified for TRIM, so it defaults to BOTH.

Rows: 1Execution time: 6.61ms

The following example omits the <trim_characters> parameter but specifies the TRAILING parameter, and thus trims whitespace from the right side of a string:

Rows: 1Execution time: 5.53ms

The following example omits the <trim_characters> parameter and specifies no part of the string, and thus trims whitespace from both sides of a string:

Rows: 1Execution time: 5.37ms