I have the following code snippet:
long count = 0;
Scanner s = null;
s = new Scanner(new BufferedReader(new FileReader("data.txt")));
while(s.hasNext()){
System.out.println("number of words : "+ ++count);
}
The data.txt file contains some words separated by tabs and spaces. I want to detect when the words are separated by only space and when they are separated by tabs. More specifically, I want to detect the current delimiter being used by Scanner object.