replacing spaces

Discussion in 'Ruby' started by Vapor .., Nov 19, 2007.

  1. Vapor ..

    Vapor .. Guest

    I have a long string "that looks like this". I want to replace all
    spaces in the string with " and ".
    --
    Posted via http://www.ruby-forum.com/.
     
    Vapor .., Nov 19, 2007
    #1
    1. Advertising

  2. Alle luned=C3=AC 19 novembre 2007, Vapor .. ha scritto:
    > I have a long string "that looks like this". I want to replace all
    > spaces in the string with " and ".


    "that looks like this".gsub(" ", " and ")
    =3D> that and looks and like and this

    Stefano
     
    Stefano Crocco, Nov 19, 2007
    #2
    1. Advertising

  3. Vapor ..

    Vapor .. Guest

    Stefano Crocco wrote:
    > Alle lunedì 19 novembre 2007, Vapor .. ha scritto:
    >> I have a long string "that looks like this". I want to replace all
    >> spaces in the string with " and ".

    >
    > "that looks like this".gsub(" ", " and ")
    > => that and looks and like and this
    >
    > Stefano


    thanks :)
    --
    Posted via http://www.ruby-forum.com/.
     
    Vapor .., Nov 19, 2007
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. John B. Matthews
    Replies:
    4
    Views:
    682
    John B. Matthews
    Sep 12, 2008
  2. Rob Meade

    Replacing - and not Replacing...

    Rob Meade, Apr 5, 2005, in forum: ASP General
    Replies:
    5
    Views:
    297
    Chris Hohmann
    Apr 11, 2005
  3. George George

    replacing verticle white spaces?

    George George, Jul 17, 2009, in forum: Ruby
    Replies:
    4
    Views:
    151
  4. Philo Hippo

    problem replacing spaces in a string

    Philo Hippo, Oct 11, 2004, in forum: Javascript
    Replies:
    2
    Views:
    86
    Philo Hippo
    Oct 12, 2004
  5. Aristotle

    Replacing spaces

    Aristotle, Sep 19, 2004, in forum: Perl Misc
    Replies:
    10
    Views:
    501
    Ian Wilson
    Sep 20, 2004
Loading...

Share This Page