Counts the occurrences of a target character in a given string.
The input string.
The character to count occurrences of.
The number of occurrences of targetChar in str.
targetChar
str
Counts the occurrences of a target character in a given string.