文字列currLine = "0 1435 " 3029 " "(1975.92)" " 72,304""
(文字列内に引用符があります) があり、すべての整数を currLine に出力したいと考えています。しかし、以下のコードでは、数字の 0 しか出力されません。すべての整数を出力するように nextInt() を使用するにはどうすればよいですか?
Scanner scanLine = new Scanner(currLine);
while (scanLine.hasNext()) {
if (scanLine.hasNextInt()) {
System.out.println(scanLine.nextInt());
}
scanLine.next();
}