Name
TrimStr -- strip leading or tailing characters (V2.0)
Synopsis
s$ = TrimStr(src$, chr$, tail[, encoding])
Function
This function can be used to strip all characters that match chr$ from the head or the tail of src$. The string chr$ must only contain one character. tail must be True to start stripping from the right or False to start from the left side. The stripped string will be returned.

The optional encoding parameter can be used to set the character encoding to use. This defaults to the default string encoding set using SetDefaultEncoding(). See Character encodings for details.

Inputs
src$
string to strip
chr$
a single character string
tail
True or False indicating where to begin
encoding
optional: character encoding to use (defaults to default string encoding) (V7.0)
Results
s$
a stripped string
Example
a$ = TrimStr("aaaaHello World", "a", False)
DebugPrint(a$)
Prints "Hello World".


a$ = TrimStr("aaaaHello Worldaaaa", "a", True)
DebugPrint(a$)
Prints "aaaaHello World".

Show TOC