mercredi 25 février 2015

Scala: How can I use a count function for multiple letters

Ok so I'm trying to check the number of occurrences of a, b and c in a string and I'm trying to use a count function to do. Can I use that with multiple letters?


Would this work?



"cat".count(_ == 'a', 'b', 'c')

Aucun commentaire:

Enregistrer un commentaire