私はこの String を持ってい9 $ -2 -
ます。-
の次が数字かどうかをテストしたい。
if (ch == '-') {
if (ch != input.length() - 1) {
char next = input.charAt(j + 1);
if ((next >= '0' && next <= '9') || next == '.')
temp = temp + ch;
}
}
-
文字列の最後にある可能性がある場合、それを行う方法が見つかりません
Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String index out of range: 8
at java.lang.String.charAt(String.java:658)
at ParsePost.doParse(ParsePost.java:24)
at InfixApp.main(InfixApp.java:20)