PDA

View Full Version : Action Script Recursion




mikepro44
May 12, 2009, 08:59 PM
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



angelwatt
May 12, 2009, 09:24 PM
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.