Jacob Fugal
9/26/2006 2:33:00 PM
On 9/26/06, Farrel Lifson <farrel.lifson@gmail.com> wrote:
> On 26/09/06, voipfc@googlemail.com <voipfc@googlemail.com> wrote:
> >
> > What is ruby's equivalent of PHPs explode?
> >
> > A routine which can breakdown a string and return the results in an
> > array or a routine that can parse an .ini file and return the key
> > value pairs in an array[key]=value.
>
> irb(main):006:0> "this is a string".split
> => ["this", "is", "a", "string"]
Also, can take an argument to split on a character/pattern besides space:
irb>> "this is a string".split('s')
=> ["thi", " i", " a ", "tring"]
irb>> "this is a string".split(/[aeiou]/)
=> ["th", "s ", "s ", " str", "ng"]
Jacob Fugal