strtrim

Trims characters from beginning and end of string. (version 4.67 or later)

Format

strtrim <strvar> <trimchars>

Remarks

Removes all occurrences of a set of characters specified in the <trimchars> from the beginning end end of the string variable <strvar>.

Example

src='   '#9' #include <stdio.h>      '#9' '
strtrim src ' \t'
messagebox src 'result'          ; '#include <stdio.h>'

src='         #include <stdio.h>         '
strtrim src ' '
messagebox src 'result'          ; '#include <stdio.h>'

src='*;|@123***456@|;'
strtrim src '*;|@'
messagebox src 'result'          ; '123***456'

src='*;|@123***456@|;'
strtrim src '*;|@123456'
messagebox src 'result'          ; ''

src='#*;|@123***456@|;'
strtrim src '*;|@'
messagebox src 'result'          ; '#*;|@123***456'

src='*;|@123***456@|;#'
strtrim src '*;|@'
messagebox src 'result'          ; '123***456@|;#'

See also