Action Script Recursion

Discussion in 'Web Design and Development' started by mikepro44, May 12, 2009.

  1. mikepro44 macrumors member

    Joined:
    May 18, 2008
    #1
    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
     
  2. angelwatt Moderator emeritus

    angelwatt

    Joined:
    Aug 16, 2005
    Location:
    USA
    #2
    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.
     

Share This Page