StringTrim()
- Last UpdatedJul 22, 2024
- 1 minute read
Removes unwanted spaces from text and returns the result.
Category
String
Syntax
StringResult = StringTrim( Text, TrimType );
Parameter
Text
String that is trimmed of spaces. Actual string or a string attribute.
TrimType
Determines how the string is trimmed. Possible values are:
1 = Remove leading spaces to the left of the first non-space character
2 = Remove trailing spaces to the right of the last non-space character
3 = Remove all spaces except for single spaces between words
Remarks
The text is searched for white-spaces (ASCII 0x09-0x0D or 0x20) that are to be removed. TrimType determines the method used by the function:
Examples
All spaces are represented by the "×" character.
StringTrim("×××××This×is×a××test×××××", 1) ' returns "This×is×a××test×××××";
StringTrim("×××××This×is×a××test×××××", 2) ' returns "×××××This×is×a××test";
StringTrim("×××××This×is×a××test×××××", 3) ' returns "This×is×a×test";
The StringReplace() function can remove ALL spaces from a specified a string attribute. Simply replace all the space characters with a "null."