You don't need to use a loop if you take advantage of the API. If you take the length of the array returned "scanning" for your substring with String#scan, you will have number of occurrences of that substring.
Reputation Points: 32
Solved Threads: 10
Junior Poster in Training
Offline 94 posts
since Mar 2006