文字列の次の文字を見つけるための "次のソース文字"コードの記述方法がわかりません。Javaのパーサのスキャナで次の文字を取得する方法
public class scanner {
protected char currentChar;
protected StringBuffer currentSpelling;
protected byte currentKind;
private void take (char expectedChar){
if (currentChar == expectedChar){
currentSpelling.append(currentChar);
currentChar = next source character;
}
}
private void takeIt(){
currentSpelling.append(currentChar);
currentChar = next source character;
}
}
forループを使用します。 * String * .charAt() - メソッドのインデックスを使用してください。 – Seth