Ignore parentheses with string tokenizer?
问题 I have an input that looks like: (0 0 0) I would like to ignore the parenthesis and only add the numbers, in this case 0, to an arraylist. I am using scanner to read from a file and this is what I have so far transitionInput = data.nextLine(); st = new StringTokenizer(transitionInput,"()", true); while (st.hasMoreTokens()) { transition.add(st.nextToken(",")); } However, the output looks like this [(0 0 0)] I would like to ignore the parentheses 回答1: You are first using () as delimiters, then