Class: String
Description
This method trims the characters from a string. This method replaces the $$TRIM^%ZS(), $$LTRIM^%ZS(), $$RTRIM^%ZS(), and $$RTB^%ZFUNC() functions.
Syntax
StringObject.trim(Number sides,String char)
Parameters
sides |
Denotes from which side(s) the character shall be removed:
|
char |
The character to remove from the beginning and/or the end of the string. The default is space. |
Returns
A String.
When Became Available
v7.0
Example
type String HDR = "*** Hello World! ***"
// Remove leading asterisk first: " Hello World! ***"
type String CLEANL = HDR.trim(-1,"*")
// Remove trailing asterisk as well: " Hello World! "
type String CLEANR = CLEANL.trim(1,"*")
// Get rid of spaces as well (both sides)
type String ALLCLEAN = CLEAN.trim() // "Hello World!"