

The value checked by topPage.indexOf() does not need the added comma. The only change was to remove the trailing comma from temp value - your comma delimited string does not end with a comma, so it could never find the last value. String.Search(searchValueRegex) returns an index integer or -1 if the string isn't found.String.Matches(searchValueRegex) returns an array including all matches or null if not found.


While Klaus is correct that you are working with integers, they arrive at your code as a single string, so it's a valid question.
