string llStringTrim(string text, integer trim_type)
Outputs a string eliminating whitespace from the start and/or end of the specified string.
Constants for trim_type:
STRING_TRIM_HEAD: trim all leading spaces in text
STRING_TRIM_TAIL: trim all trailing spaces in text
STRING_TRIM: trim all leading and trailing spaces in text
In this case, whitespace can mean:
- Spaces (ASCII 32)
- Tabs (ASCII 9) - \t
- New line (ASCII 10) - \n
To eliminate all whitespace:
Example:
llStringTrim(" Testing 1 2 3 ", STRING_TRIM);
Output:
To eliminate only the starting whitespace:
Example:
llStringTrim(" \tTesting 1 2 3 ", STRING_TRIM_HEAD);
Output:
To eliminate only the ending whitespace:
Example:
llStringTrim(" Testing 1 2 3 \n", STRING_TRIM_TAIL);
Output:
Functions |
String