- (string-trim s [char/char-set/pred start end]) -> stringprocedure
- (string-trim-right s [char/char-set/pred start end]) -> stringprocedure
- (string-trim-both s [char/char-set/pred start end]) -> stringprocedure
Trim S by skipping over all characters on the left / on the right / on both sides that satisfy the second parameter CHAR/CHAR-SET/PRED:
- if it is a character CHAR, characters equal to CHAR are trimmed;
- if it is a char set CS, characters contained in CS are trimmed;
- if it is a predicate PRED, it is a test predicate that is applied to the characters in S; a character causing it to return true is skipped.
CHAR/CHAR-SET/PRED defaults to the character set char-set:whitespace defined in SRFI 14.
If no trimming occurs, these functions may return either S or a copy of S; in some implementations, proper substrings may share memory with S.
(string-trim-both " The outlook wasn't brilliant, \n\r") => "The outlook wasn't brilliant,"