In a WinForms textbox with multiple whitespaces (e.g. 1 1 A), where, between the 1s, there is whitespace, how could I detect this via the string methods or regex?
int NumberOfWhiteSpaceOccurances(string textFromTextBox){
char[] textHolder = textFromTextBox.toCharArray();
int numberOfWhiteSpaceOccurances = 0;
for(int index= 0; index < textHolder.length; index++){
if(textHolder[index] == ' ')numberOfWhiteSpaceOccurances++;
}
return numberOfWhiteSpaceOccurances;
}