What is the simplest way to count the number of occurrences of a specific character in a string?
That is, I need to write a function, countTheCharacters(), so that
str = "the little red hen"
count = countTheCharacters(str,"e") ' Count should equal 4
count = countTheCharacters(str,"t") ' Count should equal 3
Question&Answers:os