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. Advertisements

  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. Advertisements

  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. Advertisements

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:
    941
    John B. Matthews
    Sep 12, 2008
  2. Roedy Green
    Replies:
    3
    Views:
    837
  3. Tomasz Chmielewski

    [CSS] how can I show spaces as spaces?

    Tomasz Chmielewski, Sep 5, 2009, in forum: HTML
    Replies:
    21
    Views:
    2,075
    Jan C. Faerber
    Sep 10, 2009
  4. Tomasz Chmielewski

    how can I show spaces as spaces, part 2

    Tomasz Chmielewski, Sep 9, 2009, in forum: HTML
    Replies:
    14
    Views:
    1,195
    Jan C. Faerber
    Sep 10, 2009
  5. Rob Meade

    Replacing - and not Replacing...

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

    replacing verticle white spaces?

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

    problem replacing spaces in a string

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

    Replacing spaces

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