static String getNextCommaToken ( String inString ) { String token = "" ; //number of open parenthesis int parenthesis = 0 ; for ( int i = 0 ; i < inString . length ( ) ; i ++ ) { if ( OPEN_PARENTHESIS == inString . charAt ( i ) ) { parenthesis ++ ; token += inString . charAt ( i ) ; } else if ( CLOSE_PARENTHESIS == inString . charAt ( i ) ) { parenthesis -- ; token += inString . charAt ( i ) ; } else if ( COMMA == inString . charAt ( i ) ) { //if there is no open parenthesis finish if ( parenthesis == 0 ) { break ; } else { token += inString . charAt ( i ) ; } } else { token += inString . charAt ( i ) ; } } return token ; }
Computes the first argument from a list of arguments