Mega Code Archive

 
Categories / Ruby / String
 

Scan as split

text = "this is a test." puts "Scan method: #{text.scan(/\w+/).length}"