mardi 18 avril 2017

How does count work in Ruby when a string is set as the parameter?

How does count work in this code:

name= "abcdef"
puts name.count("aeiou")
puts name.count("^aeiou")

Does it count for the occurrences of "a", "e", "i", "o" and "u"?

If yes, how can I count the occurrences of "aeiou" as a single string?

Does the negation include counting for 'spaces'? Why/why not?

Aucun commentaire:

Enregistrer un commentaire