Hi --

On Mon, 29 Sep 2008, Nick Bo wrote:

> eg: str = "a b c d"
> newStr = str.sub(" ", ", ")
>
> gives me output a, b c d
>
> what i want is a, b, c, d
>
> ow do i make this happen sub isnt doing it for me i guess.  I been
> looking all through the ruby-doc to no avail.

Check out String#gsub, and also Array#join.


David

-- 
Rails training from David A. Black and Ruby Power and Light:
   Intro to Ruby on Rails  January 12-15   Fort Lauderdale, FL
   Advancing with Rails    January 19-22   Fort Lauderdale, FL *
   * Co-taught with Patrick Ewing!
See http://www.rubypal.com for details and updates!