Find out the number of times a character is repeated in a string without using iteration
Problem
You want to find out the number of times a specific character is repeated in a
string, but you don't want to use iterative blocks like while, for etc..
Solution
Use the
Split
method, and subtract 1 from the length of the string returned.
Example
string input = "123#345#456#";
int count = input.Split("#").Length - 1; // Returns 3