0
/ 50
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...
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 feedback will appear here when you check your answer.