[racket-dev] `string-split'
On Thu, Apr 19, 2012 at 14:33, Matthew Flatt <mflatt at cs.utah.edu> wrote:
> I agree with this: we should add `string-split', the one-argument case
> should be as Eli wrote,
About this I'm not sure, as one cannot reproduce this behavior by providing
an argument (or it could make the difference between string-as-not-regexps
and regexps? Wouldn't this be different from other places?).
It would then appear somewhat magical. To me the " " default splitter seems
more intuitive.
Laurent
> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/dev/archive/attachments/20120419/99cc94a4/attachment.html>