Kernel 8.0 APIs Banner [skip navigation]
Office of Information & Technology (OIT) Banner

$$TRIM^XLFSTR(): Trim String

Reference Type: Supported, Category: String Functions, Integration Agreement: 10104

Description

This extrinsic function trims spaces or other specified characters from the left, right, or both ends of an input string.

Format

  $$TRIM^XLFSTR(s[,f][,c])

Input Parameters

s:

(required) Character string.

f:

(optional) This flag can have the following value:

  • "LR" (default)—Trim characters from both ends of the string.

     
  • "L"—Trim characters from the left/beginning of the string.

     
  • "R"—Trim characters from the right/end of the string.
c: (optional) Set this parameter to the character to trim from the input string. This parameter defaults to a space.

Output

returns: Returns the trimmed string.

Example 1

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.

Example 2

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."

Example 3

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//]

Example 4

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]


VA (Internet) / VA(Intranet) / OI / PD / Site Map / Terms of Use / VA Privacy Policy / Accessibility

Reviewed/Updated: August 26, 2011

If you have questions, need more information, or are having accessibility problems with this website, please contact us by E-Mail: Webmasters, Phone: 510-768-6800, or FAX: 510-768-6850.