Trim()
FUNCTION: trim(<string> [,<trim style> ,<trim chars>])
This function will trim trailing and/or leading characters on the string that you specify. <trim chars> specifies the character or multi-character pattern to trim (default is space), and <trim style> tells the kind of trimming to perform (default is trim both sides of the string). Multi-character patterns such as %r (CRLF) are supported.
The following values for <trim style> are recognized:
'b' : Trim both ends of the string (default)
'l' : Trim the left end of the string.
'r' : Trim the right end of the string.
Note: anything else specified for <trim style> will trim both sides.
Example:
> say trim(;;;Wacka;;;,,;)
You say, "Wacka"
> say trim(%b%b%b Polly Parrot %b%b%b%b,r)
You say, " Polly Parrot"
> say trim(---Trim Rules!---,l,-)
You say, "Trim Rules!---"