Note: This release is in preview. Features described here don’t become generally available until the latest general availability date that Salesforce announces for this release. Before then, and where features are noted as beta, pilot, or developer preview, we can’t guarantee general availability within any particular time frame or at all. Make your purchase decisions only on the basis of generally available products and features.

trim()

Removes the specified substring from the beginning and the end of a string.

Syntax

trim(string,substr)

Usage

This function removes substr from the beginning and end of string, then returns the result. To remove leading and trailing spaces, do not specify a value for substr.

Example

1–-  the resulting string in both cases is 'MyString';
2q = foreach q generate trim("abcMyStringabc","abc") as 'Trimmed String';
3q = foreach q generate trim("     MyString     ") as 'Trimmed String';