What is the best way to count the number of numeric elements within a string where the elements are delimited by '/'?
For example, in the string "OL/12/15/NR/17/21", we have 4 numeric elements. The only non-numeric (i.e. alpha) elements that can be found in the array are "OL" (off ladder) and "NR" (no result).
This is my solution but I suspect that there are better, more efficient algorithms:
int cnt = 0;
string sampleString = "OL/12/15/NR/17/21";
string[] sampleArray = sampleString.split('/');
foreach (string element in sampleArray)
if (element != "OL" && element != "NR")
cnt++;