Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

mikepro44

macrumors member
Original poster
May 18, 2008
86
0
trying to solve this Question..

any tips on where to go with it?

Use the following function definition:

function countChar(str:String, ch:String, n:Number)
To count the number of occurrences of ‘ch’ in ‘str’
For example:
countChar(“aabba”,”a”,0) = 3
countChar(“asdf”,”z”,0) = 0
Hint: need to use string.substring() method
 
Well is looks like the teacher already gave you a big hint by telling you a function to make use of. Have you studied how that function works? Try to put something together and post it and we can try to give hints based on your attempt.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.