indicate blank line to tokenizer

My code reads in a file line by line, and tokenizes each line of the file, for example:

bla bla bla

more words bla

bla bla

words words

words words words

words words words

bla bla bla bla

As you can see, in the above file, there are blank lines. When reading through each line of the file and tokenizing it with strArray (I put the tokens on each line of the file into an array), I do this:

if(strArray[0].equals("bla"))

{

DO SOMETHING

}

What I want to say is if the StringTokenizer hits a blank line, do SOMETHING ELSE. But how do I indicate that to the StringTokenizer, i.e. how does it recognise a blank line?

[809 byte] By [Lars100a] at [2007-10-2 22:02:12]
# 1
> What I want to say is if the StringTokenizer hits a> blank line, do SOMETHING ELSE. But how do I indicate> that to the StringTokenizer, i.e. how does it> recognise a blank line?Two consecutive newlines?
Lokoa at 2007-7-14 1:18:40 > top of Java-index,Java Essentials,New To Java...
# 2
if(strArray[0].equals("\n\n"))that doesn't work I'm afraid. I get java.lang.ArrayIndexOutOfBoundsException: 0
Lars100a at 2007-7-14 1:18:40 > top of Java-index,Java Essentials,New To Java...
# 3
I also triedst = new StringTokenizer(line, " .\t\r\n");andif(strArray[0].equals("\r\n"))But I still get ArrayIndex out of bounds exception
Lars100a at 2007-7-14 1:18:40 > top of Java-index,Java Essentials,New To Java...
# 4
Ok so I tried to split the lines only by punctuation characters and then doif(strArray[0].equals("\r\r")) But I still get array index out of bounds so what am I doing wrong?
Lars100a at 2007-7-14 1:18:40 > top of Java-index,Java Essentials,New To Java...
# 5

It appears that strArray has a length of zero. Without seeing more of your code, I can't tell if that is the result of an error in your code or what. If strArray.length equals zero only when a blank line occurs, then you can write your code to detect that.if(strArray.length == 0 ) {

//do something for blank lines

} else if(strArray[0].equals("\r\r")) {

//do soomething else

}

atmguya at 2007-7-14 1:18:40 > top of Java-index,Java Essentials,New To Java...