private int parseOptDigit() { if (pos < str.Length) { int ch = str[pos]; if ('0' <= ch && ch <= '9') { pos++; return ch - '0'; } } return -1; }