scanner « class file « Java I/O Q&A





1. problem with use delimiter in scanner class    stackoverflow.com

    try {
    Scanner in = new Scanner(new File("text.txt"));

    Formatter out = new Formatter("text1.txt");
    in.useDelimiter(",");
    int ...

2. Scanner Class hasNextLine infinite loop    stackoverflow.com

why does this piece of code go into an infinite loop when I try to give it a basic text file?

import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.util.*;
public class TestFile
{

    public ...

3. Java scanner class, reading from a file    stackoverflow.com

How do i carry out a OR constraint in java when searching for for something. Lets say i have a txt file and want to search the file for car OR bike ...

4. help using scanner class to count chars in file    forums.oracle.com

you can't use nextLine() because it is going to eat line terminators. And No, you can't assume that you know how many characters that is and do something tricky. If you want to count characters I would suggest that you look at the docs for Scanner and see if there is something that will allow you to get characters.