我在扫描仪中读取文字,但我需要知道扫描仪是否更改为以下行。这是一个进度条(计数线)。 你能帮助我吗?这是我的代码:
Pattern pattern = Pattern.compile("[^\\p{Alpha}]+");
try (Scanner sc = new Scanner(file)) {
while (sc.hasNext()) {
sc.useDelimiter(pattern);
long totalLines = countLines(f);//Method that count Lines
System.out.println("Reading " + totalLines + "Lines...");
word = sc.next();//here i need to know if the scanner jumps to next Line or not.