find search word within a string

Discussion in 'Ruby' started by M. R., Jul 31, 2007.

  1. M. R.

    M. R. Guest

    Hi @ all

    I would like to search in a string a user-defined word and I want to
    find out, how many times its appear in the string. Can anyone help me?

    thanks for your effort...
    --
    Posted via http://www.ruby-forum.com/.
    M. R., Jul 31, 2007
    #1
    1. Advertising

  2. M. R.

    Tim Pease Guest

    On 7/31/07, M. R. <> wrote:
    > Hi @ all
    >
    > I would like to search in a string a user-defined word and I want to
    > find out, how many times its appear in the string. Can anyone help me?
    >


    String#scan

    Please read the documentation for details.

    Blessings,
    TwP
    Tim Pease, Jul 31, 2007
    #2
    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. Smart
    Replies:
    3
    Views:
    3,949
    Roedy Green
    Feb 1, 2006
  2. Adrian
    Replies:
    7
    Views:
    433
    Adrian
    Jul 12, 2007
  3. Abby Lee
    Replies:
    5
    Views:
    393
    Abby Lee
    Aug 2, 2004
  4. Abe
    Replies:
    2
    Views:
    165
  5. Mohit Sindhwani
    Replies:
    5
    Views:
    191
    Mohit Sindhwani
    Oct 27, 2008
Loading...

Share This Page