[plt-scheme] Re: Characters in a String

From: David Van Horn (dvanhorn at cs.uvm.edu)
Date: Fri May 28 11:17:59 EDT 2004

Eli Barzilay <eli at ...> writes:
> On May 28, David Van Horn wrote:
> > (string-tokenize "Help make programs run, run, RUN!") =>
> >   ("Help" "make" "programs" "run," "run," "RUN!")
> 
> And if you mention this, then you might as well include
> 
>   > (regexp-split #rx" +" "Help make programs run, run, RUN!")
>   ("Help" "make" "programs" "run," "run," "RUN!")
> 
> so you can even do this:
> 
>   > (regexp-split #rx"[ ,!]+" "Help make programs run, run, RUN!")
>   ("Help" "make" "programs" "run" "run" "RUN" "")

Right, but string-tokenize is "standard" among Schemes (if that matters).  
Also, you're example could easily be done with SRFI 13 & 14:

(string-tokenize "Help make programs run, run, RUN!"
                 (char-set-delete char-set:graphic #\, #\!))

David



Posted on the users mailing list.