private String nextToken(char[] delimiters)
{
string token = "";
long pos = currentPos;
//skip possible delimiters
while (Array.IndexOf(delimiters, chars[currentPos]) != -1)
//The last one is a delimiter (i.e there is no more tokens)
if (++currentPos == chars.Length)
{
currentPos = pos;
throw new ArgumentOutOfRangeException();
}
//getting the token
while (Array.IndexOf(delimiters, chars[currentPos]) == -1)
{
token += chars[currentPos];
//the last one is not a delimiter
if (++currentPos == chars.Length)
break;
}
return token;
}