[plt-scheme] Re: Characters in a String

From: Eli Barzilay (eli at barzilay.org)
Date: Fri May 28 10:50:44 EDT 2004

On May 28, David Van Horn wrote:
> As Dominique said, string->list will take a string to a list of
> characters.  But you might also want to have a look at SRFI 13's
> string-tokenize which will take a string to a list of strings based
> on whitespace.
> 
> (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" "")

-- 
          ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
                  http://www.barzilay.org/                 Maze is Life!


Posted on the users mailing list.