Geekpedia Programming Tutorials






Count Words In String

The simplest way to count words in a string using Ruby and regular expressions by splitting the string at each space.

On Friday, May 2nd 2008 at 11:20 PM
By Andrei Pociu (View Profile)
-----   (Rated 0 with 0 votes)
Contextual Ads
More Ruby Resources
Advertisement
  1. class String
  2.   def WordCounter
  3.     split(/\S+/).size
  4.   end
  5. end
Digg Digg It!     Del.icio.us Del.icio.us     Reddit Reddit     StumbleUpon StumbleIt     Newsvine Newsvine     Furl Furl     BlinkList BlinkList

Rate Rate this code snippet
Comment Current Comments
by umani on Monday, May 19th 2008 at 05:19 PM

please send the code of gui and filehandling in java

by kawan on Friday, June 6th 2008 at 06:46 AM

you can help me to search the programming. it something like ruby 1.8.6


Comment Comment on this tutorial
Name: Email:
Message:
Comment Related Source Code
There is no related code.

Comment Related Tutorials
There are no related tutorials.

Jobs Ruby Job Search
My skills include:
Enter a City:

Select a State:


Advanced Search >>
Latest Tech Bargains

Advertisement

Free Magazine Subscriptions

Today's Pictures

Today's Video

Other Resources

Latest Download

Latest Icons