Name

strtrim — Remove whitespace or other characters from the beginning/end of a string

Synopsis

strtrim string [totrim]
strtriml string [totrim]
strtrimr string [totrim]

Description

The strtrim command "trims" any leading or trailing whitespace from the string passed to it. The strtriml and strtrimr commands trim from, and only from, the left and right sides of the string, respectively. All of the trim commands take an optional argument that specifies what exactly to trim.

Examples

hecl> strtrim " foo "
foo
hecl> strtrim "hello world" "he"
llo world
hecl> strtriml "xxxyyyzzzxxx" xxx
yyyzzzxxx
hecl> strtrim "        alone          "
alone