Topic: A question about split

I want to split a string by space, for example, split  (this is a test string "1, 2, 3") as follow:

this
is
a
test
string
"1, 2, 3"

How can I do?

Re: A question about split

you could do something like:

str = 'this is a test string "1, 2, 3"'

spaced, quoted = str.split(/\s(".*)/)
spaced = spaced.split

-patrick

Re: A question about split

patrick99e99 wrote:

you could do something like:

str = 'this is a test string "1, 2, 3"'

spaced, quoted = str.split(/\s(".*)/)
spaced = spaced.split

-patrick

Thank you very much. It's very useful to me