Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > find search word within a string

Reply
Thread Tools

find search word within a string

 
 
M. R.
Guest
Posts: n/a
 
      07-31-2007
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/.

 
Reply With Quote
 
 
 
 
Tim Pease
Guest
Posts: n/a
 
      07-31-2007
On 7/31/07, M. R. <(E-Mail Removed)> 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

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
find() a larger string within a smaller string korean_dave Python 3 11-14-2008 08:05 PM
Why does string.find(x, npos) search from the begining of the string Adrian C++ 7 07-12-2007 03:33 PM
Using values within arrays within a hash to gsub into an input word... Abe Ruby 2 04-15-2006 08:16 PM
Does anyone have a JAVA script that will search for a string within a string? Smart Java 3 02-01-2006 10:46 AM
search within a search within a search - looking for better way...my script times out Abby Lee ASP General 5 08-02-2004 04:01 PM



Advertisments