It seems that s[1] somehow misses the s1.equals("") comparison. The
thing to check is what and how many characters s[1] contains. Add
something like:
        int     nLength = s[1].length()
        System.out.println("Length of s[1]: " + nLength);
        for (int i = 0; i < nLength; i++)
        {
                System.out.println("s[1] character " + i + ": " + (int)
s[1].charAt(i));
        }

R MUTHUSWAMY wrote:
> 
> Hi Matthias,
> 
>         I changed that code and included the s1.equals("") and i found out
> that it is working that blank line is send as a blank line and other lines
> are read as a normal line.The output is shown below.
> 
> s[0]=this is a test file which can
> s[1]=
> s[2]=be deleted when not needed.
> 
> bye,
> MUTHU.
> 
> On Fri, 9 Jul 1999, Matthias Pfisterer wrote:
> 
> > No. From the Java documentation (java.io.DataInput, readLine()):
> >
> > > If the character '\n' is encountered, it is discarded and reading
> > >      ceases. If the character '\r' is encountered, it is discarded and, if the 
>following byte converts to the character
> > >      '\n', then that is discarded also; reading then ceases. If end of file is 
>encountered before either of the characters
> > >      '\n' and '\r' is encountered, reading ceases. Once reading has ceased, a 
>String is returned that contains all the
> > >      characters read and not discarded, taken in order.
> >
> > By the way, I've tested the programm with my proposal.
> >
> > Matthias Pfisterer
> >
> >
> >
> > Larry Gates wrote:
> > >
> > > >Date: Thu, 08 Jul 1999 12:48:49 +0200
> > > >From: Matthias Pfisterer <[EMAIL PROTECTED]>
> > > >
> > > >Hi,
> > > >
> > > >In your java program, exchange the line
> > > >       if (s1.charAt(0)!='#') { // not a comment or NULL line
> > > >with
> > > >       if (s1.equals("") || s1.charAt(0)!='#') { // not a comment or NULL line
> > >
> > > or it could be a return character? Then, you would need
> > >
> > > if (s1.equals("\n") || s1.charAt(0)!='#') { // not a comment or NULL line
> > >
> > > -Larry Gates
> > >
> > > ----------------------------------------------------------------------
> > > To UNSUBSCRIBE, email to [EMAIL PROTECTED]
> > > with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
> >
> >
> > ----------------------------------------------------------------------
> > To UNSUBSCRIBE, email to [EMAIL PROTECTED]
> > with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
> >
> 
> ----------------------------------------------------------------------
> To UNSUBSCRIBE, email to [EMAIL PROTECTED]
> with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]


----------------------------------------------------------------------
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to