Description
The TRIM function removes leading and trailing whitespace (blank character spaces) from a text value.
Usage
TRIM(text)
| Argument | Type | Required | Description |
|---|---|---|---|
| text | Text | Yes | The input text |
Remarks
TRIM removes spaces, tabs, new lines, page breaks, nulls and other whitespace characters from the beginning and end of the text. Whitespace between words inside the text is left unchanged.
If the text consists entirely of whitespace, the result is blank.
If the text argument is blank, the result is blank.
TRIM is particularly useful when cleaning data imported from external sources, where leading or trailing spaces can cause values that look identical to compare as unequal.
Examples
When data is imported from a spreadsheet or CSV file, text values sometimes contain accidental leading or trailing spaces. You can use TRIM to remove these spaces when doing your analysis.
TRIM(CASE_ID) == "ABC-001"
Without TRIM, a value of " ABC-001" (with a leading space) would not match.