![]() ![]() |
Reference Type: Supported, Category: String Functions, ICR#: 10104
The $$TRIM^XLFSTR extrinsic function trims spaces or other specified characters from the left, right, or both ends of an input string.
$$TRIM^XLFSTR(s[,f][,c])
s: |
(required) Character string. |
f: |
(optional) This flag can have the following value:
|
c: | (optional) Set this parameter to the character to trim from the input string. This parameter defaults to a space. |
returns: | Returns the trimmed string. |
In this example, we are trimming the spaces from both the left and right end of the string (the brackets are added to more clearly display the trimmed string):
>S X="["_$$TRIM^XLFSTR(" A B C ")_"]" >W X [A B C] |
The second input parameter defaults to LR and the third input parameter defaults to spaces.
In this example, we are trimming the slashes from both the left and right end of the string (the brackets are added to more clearly display the trimmed string):
>S X="["_$$TRIM^XLFSTR("//A B C//",,"/")_"]" >W X [A B C] |
The second input parameter defaults to LR.
In this example, we are trimming the slashes from the left end of the string (the brackets are added to more clearly display the trimmed string):
>S X="["_$$TRIM^XLFSTR("//A B C//","L","/")_"]" >W X [A B C//] |
In this example, we are trimming the slashes from the right end of the string (the brackets are added to more clearly display the trimmed string):
>S X="["_$$TRIM^XLFSTR("//A B C//","r","/")_"]" >W X [//A B C] |