[racket] string-strip

From: Sam Phillips (samdphillips at gmail.com)
Date: Tue Dec 27 12:59:35 EST 2011

On Tue, Dec 27, 2011 at 09:55, Marijn <hkBst at gentoo.org> wrote:
> Sometimes I wish for python-like string-strip to be a standard
> function. For example when I want to parse a list of numbers from a
> text-field, I could get the string value of the text-field, strip
> space from the beginning and end, split on whitespace, map
> string->number over it and check the result with `every'.
>
> Is there a better way? If not then perhaps some form of string-strip
> could be added (perhaps under regexp-strip name?) since it isn't
> exactly extremely simple unless you're a regexp wizard.

string-trim-both in srfi-13 does that.

http://docs.racket-lang.org/srfi-std/srfi-13.html#string-trim

Cheers,
Sam


Posted on the users mailing list.