[racket-dev] `string-split'

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Thu Apr 19 08:33:09 EDT 2012

I agree with this: we should add `string-split', the one-argument case
should be as Eli wrote, and the two-argument case should be as Laurent
wrote. (Probably the optional second argument should be string-or-#f,
where #f means to use #px"\\s+".)

At Thu, 19 Apr 2012 14:30:31 +0200, Laurent wrote:
>  (define (string-split str [sep #px"\\s+"])
> >    (remove* '("") (regexp-split sep str)))
> >
> Nearly, I meant something more like this:
> (define (string-split str [splitter " "])
>   (regexp-split (regexp-quote splitter) str))
> No regexp from the user POV, and much easier to use with little knowledge.
> _________________________
>   Racket Developers list:
>   http://lists.racket-lang.org/dev

Posted on the dev mailing list.