TRIM ER function

The TRIM function returns the specified text string as a String value after tab, carriage return, line feed, and form feed characters have been replaced by a single space character, after leading and trailing spaces have been truncated, and after multiple spaces between words have been removed.

Syntax

TRIM (text)

Arguments

text: String

The valid path of a data source of the String type.

Return values

String

The resulting text value.

Usage notes

In some cases, you might want to truncate leading and trailing spaces but prefer to keep formatting for the specified text. For example, when this text represents an address that could be entered in the multi-line text box and could contain line feed and carriage return formatting. In this case, use the following expression: REPLACE(text,"^[ \t]+|[ \t]+$","", true) where text is the argument that refers to the specified text string.

Example 1

TRIM ("     Sample     text     ") returns "Sample text".

Example 2

TRIM (CONCATENATE (CHAR(10), "     Sample     ", CHAR(9),"     text     ", CHAR(13))) returns "Sample text".

Additional resources

Text functions

REPLACE ER function