String count method in 1.9

S

Satish Talim

[Note: parts of this message were removed to make it a legal post.]

As per the Ruby documentation,
string.count(character_set1,character_set2)first takes the
intersection of
character_set1 and character_set2 and then counts the number of times each
character from the resulting intersection occurs in string.

The program:
a = 'hooooooooooll'
puts a.count "lo" "o"

displays 10 in irb but displays 12 in Ruby 1.9. Why?
 
S

Satish Talim

[Note: parts of this message were removed to make it a legal post.]

Damn silly of me, to miss out the , between the two parameters. I'll
attribute it to my high fever but still can't leave aside Ruby :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,982
Messages
2,570,189
Members
46,735
Latest member
HikmatRamazanov

Latest Threads

Top