Trim()

Home   Back   Next  

Working with Formulas > Functions Used in Formulas > Text Functions > Trim()

 

TRIM() removes each character in the list from the left and right sides of the string. When a leftmost or rightmost character in the string matches a character in the list, the character in the string is removed. The process then repeats itself with all characters in the list, regardless of order, until no further leftmost or rightmost characters in the string are present in the list. If the list is blank, TRIM() removes spaces from the left and right sides of the string. See examples below for further clarification.

 

TRIM() is similar to LTRIM(), which removes characters from the left side of a string, and to RTRIM(), which removes characters from the right side of a string.

 

 

Function Format

 

TRIM(string [, list]) 

 

 

Return Value

 

TRIM() returns a character string 

 

 

Examples

 

TRIM(" APPLES ") = "APPLES" 

 

TRIM("APPLES", "AS") = "PPLE" 

 

TRIM("APPLES", "APS") = "LE" 

 

TRIM("APPLES", "E") = "APPLES" 

 

TRIM("APPLES", "APS") = "LE" 

 

TRIM ("APPLES", "PSA") = "LE" 

 

TRIM("APPLES", "PS") = "APPLE" 

 

TRIM("ABRACADABRA", "ABR") = "CAD" 

 

TRIM("ABRACADABRA", "ARBD") = "C"