Trim - script and chart function
Trim() returns the input string trimmed of any leading and trailing spaces.
Syntax:
Trim(text)
Return data type: string
Example: Chart expression
| Example | Result |
|---|---|
| Trim( ' abc' ) | Returns 'abc' |
| Trim( 'abc ' ) | Returns 'abc' |
| Trim( ' abc ' ) | Returns 'abc' |
Example: Load script
Set verbatim=1;
T1:
Load *, len(TrimString) as TrimStringLength;
Load *, trim(String) as TrimString;
Load *, len(String) as StringLength;
Load * inline [
String
' abc '
' def '](delimiter is '\t');
Information noteThe "Set verbatim=1" statement is included in the example to ensure that the spaces are not automatically trimmed before the demonstration of the trim function. See Verbatim for more information.
Result:
| String | StringLength | TrimStringLength |
|---|---|---|
| def | 6 | 3 |
| abc | 10 | 3 |