テキストからスキャンする場合
Scanner s= new Scanner("texto.txt");
// 行の次の文字を比較したい<
// このような:
if(s.nextChar().equals("<")){
.....
s.nextChar()
私はそれが存在しないことを知っていますが、この場合に使用する同様のものはありますか?
テキストからスキャンする場合
Scanner s= new Scanner("texto.txt");
// 行の次の文字を比較したい<
// このような:
if(s.nextChar().equals("<")){
.....
s.nextChar()
私はそれが存在しないことを知っていますが、この場合に使用する同様のものはありますか?
FileReader reader = null;
try {
reader = new FileReader("");
int ch = reader.read() ;
while (ch != -1) {
// check for your char here
}
} catch (FileNotFoundException ex) {
//
} catch (IOException ex) {
//
} finally {
try {
reader.close();
} catch (IOException ex) {
//
}
}
Scanner をダンプして FileReader を使用することを検討してください。
FileReader fileReader = new FileReader("textto.txt");
int charRead
while( (charRead = fileReader.read()) != -1)
{
if(charRead == '<')
{
//do something
}
}