private int getToken(String inString, int index) throws Timecode.TimecodeException {
    inString = inString.trim();
    String valid = "0123456789";
    String token = "";
    int count = 0;
    for (int i = 0; i < inString.length(); i++) {
      char current = inString.charAt(i);
      if (valid.indexOf(current) > -1) {
        token += current;
      } else {
        count++;
        if (count > index)
          break; // Found the token.
        token = ""; // Start reading the next token
      }
    }
    if (count < index || token.equals(""))
      throw new Timecode.TimecodeException("Malformed timecode '" + inString + "', can't get index=" + index);
    try {
      return Integer.parseInt(token);
    } catch (NumberFormatException ex) {
      throw new Timecode.TimecodeException("Malformed timecode '" + inString + "', '" + token + "' is not an integer");
    }
  }
private int getToken ( String inString , int index ) throws Timecode . TimecodeException { inString = inString . trim ( ) ; String valid = "0123456789" ; String token = "" ; int count = 0 ; for ( int i = 0 ; i < inString . length ( ) ; i ++ ) { char current = inString . charAt ( i ) ; if ( valid . indexOf ( current ) > - 1 ) { token += current ; } else { count ++ ; if ( count > index ) break ; token = "" ; } } if ( count < index || token . equals ( "" ) ) throw new Timecode . TimecodeException ( "Malformed timecode '" + inString + "', can't get index=" + index ) ; try { return Integer . parseInt ( token ) ; } catch ( NumberFormatException ex ) { throw new Timecode . TimecodeException ( "Malformed timecode '" + inString + "', '" + token + "' is not an integer" ) ; } }
Breaks a string on any non-numeric character and returns the index token, zero indexed