X325: countChar

Given a String str and a character ch, return the number of times ch appears in str. For example, if str is "Hello" and ch is 'l', the value returned would be 2.

Examples:

countChar("Hello", 'l') -> 2
countChar("abcdefghijklmnop", 'q') -> 0

Your Answer:

Feedback

Your feedback will appear here when you check your answer.