(trim st (? to-trim))
  st: a str
  to-trim: a str (optional)
  returns a str
F

Trims leading and trailing characters from a string.

If to-trim is not specified, whitespace characters are trimmed. Otherwise, characters are trimmed if they are present in to-trim.

The returned string is newly-allocated and mutable. st is not mutated.

(ensure (eq? "abcde" (trim " abcde "))
(ensure (eq? "bcde" (trim " abcde " "a "))
(ensure (eq? "abcde" (trim " abcde " "bcd "))
replace
trim-start