@Trim (Formula Language)

Removes leading, trailing, and redundant spaces from a text string, or from each element of a text list.

Syntax

@Trim( string )

Parameters

string

Text or text list.

Return value

trimmedString

Text or text list. The string, with extra spaces removed.

Usage

If a text string is all spaces, @Trim returns an empty string (length of 0). If an element of a text list is all spaces, @Trim removes the element. If all elements of a text list are all spaces, @Trim returns an empty string.

This function removes only spaces, not other whitespace characters such as tabs and newlines. To remove whitespace characters, you might first convert them to spaces with @ReplaceSubstring.

Examples

  1. This example returns ROBERT SMITH.
    @Trim(@UpperCase("Robert Smith    "))
  2. This example returns ROBERT SMITH.
    @UpperCase(@Trim("        Robert       Smith"))
  3. This example returns Just a quick reminder, if the original Topic field is "Just a quick reminder."
    @Trim(Topic)
  4. This example returns Seattle;Toronto;Santiago;USA;Canada;Chile if the list of values contained in the City field consists of Seattle, Toronto, Santiago; the StateOrProvince field contains no values; and the Country field contains the list of values USA, Canada, Chile.
    @Trim(City:StateOrProvince:Country)
  5. This example returns 45 if the content of the field Date is 8/29/89 16:30:45.
    @Trim(@Text(@Second(Date)))
  6. This input translation formula replaces all tabs and newlines with spaces then trims the field.
    @Trim(@ReplaceSubstring(@ThisValue; @Char(9) : @NewLine; " "))