I need to check if the final place of an array is equal to a space " ". My code below throws an out of range exception and the words variable includes a space at the end through a regex pattern.
Code:
string[] words = pattern.Split(input);
int limit = words.Count();
if(words[limit] == " ")
{ limit = limit - 1; }