Hi --
On Thu, 9 Jul 2009, Sarawut Poaitwinyu wrote:
> I have working on tag system and There is information like this
>
> "important urgent project 2009"
>
> i want to seperate into word, one word at the time is okay
>
> What is the easiest way to separate those string word by word, space
> between each word might has more than 1.
>
> My idea is to use loop to check character by character that it is space
> or not, and then cut the part, but i thought it might have easier way
> that i don't know
words = string.split
When you call split with no argument, it splits on whitespace
(including more than one character).
David
--
David A. Black / Ruby Power and Light, LLC
Ruby/Rails consulting & training:
http://www.rubypal.comNow available: The Well-Grounded Rubyist (
http://manning.com/black2)
Training! Intro to Ruby, with Black & Kastner, September 14-17
(More info:
http://rubyurl.com/vmzN)