[plt-scheme] Re: Characters in a String

From: David Van Horn (dvanhorn at cs.uvm.edu)
Date: Fri May 28 10:44:31 EDT 2004

Connor Ferguson <psfreak at ...> writes:
> Is there a way to split apart a string into its individual characters? Sort
> of like doing the reverse of make-string. The thing is, the string can be an
> arbitrary number of characters so I can't really use substring. I'm trying
> to find the spaces in a string and divide the string up into individual
> words (which I can do with substring once I know which characters are
> spaces). 
 
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!")

David




Posted on the users mailing list.