Re: converting a string to a list



David Greene wrote:
"ccc31807" <cartercc@xxxxxxxxx> wrote in message
news:389503e4-eb6a-48c2-af76-cebe1dc7141c@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
In CL, if you have a list which you can then turn into a string like
this:
(setf my-list '(this is a list)) ;make a list
(setf my-string (write-to-string my-list)) ;convert the list to
a string
In Perl, if I wanted to go the other way, I'd write:
my $str = 'This is a string'; #make a string
my $list = split $str; #convert the string to a list
How do you convert a string to a list in CL? Is there a CL equivalent
to Perl's split() function, or Java's StringTokenizer class?

Thanks, CC.
Use (cl-ppcre:split " " string-name) to get a list of the different
words in the string.

Check out the cl-ppcre package's functionality, its quite amazing.
.


Quantcast