- ⌂ Text
- Functions
TRIM()
Return a string after removing all occurrences of a leading or trailing string.
Prototype
string TRIM([{BOTH | LEADING | TRAILING} [string remstr] FROM] string str)
Parameters
- BOTH / LEADING / TRAILING - Indicates if remstr should be removed from the leading, trailing or both parts of the string.
- remstr - The string to remove. If not specified, spaces (' ') will be removed.
- str - The string to remove the trailing and/or leading remstr from.
Return
Return the string after removing all occurrences of the leading or trailing remstr.
Example 1
Remove spaces from the start and end of a contact name.
SELECT TRIM(Name) AS TrimmedName FROM Contact
Example 2
Remove "Re:" from the start of an email subject.
SELECT TRIM(LEADING 'Re:' FROM Subject) AS TrimmedSubject FROM Email
Related