I have a String of say, length is 5000. I want to find out the number of times the letter 'R' (Case Sensitive) is used. Below are the two passable solution...
- Convert to char array, loop it to perform a condition to check and increment a counter.
- Use Substring() with the character 'R' to get an array which could fetch a array. So, the total length of the array +1 will be number of times, the 'R' character in the string(This is not a better solution)
Help me out with the efficient solution on the cards for this. Thanks.