I have many strings. Each string is prepended with at least 1 $. What is the best way to loop through the chars of each string to count how many $\
$
The simplest approach would be to use LINQ:
var count = text.TakeWhile(c => c == '$').Count();
There are certainly more efficient approaches, but that's probably the simplest.