Use equalsIgnoreCase method of String, instead of "==".
----- Original Message -----
From: "Jean Chiang (���Q�g)" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, January 02, 2001 1:23 PM
Subject: The comparison between string and char.
> I am new to JSP. Who is going to help me? Thanks in advance.
> I read some input from a text file and the first parameter is an int and
> others are string. I have to do different action according to the first
> parameter.
> A part of my source code is listed as follows:
>
> In this case, when my first parameter is "1", it still shows "no". What's
> wrong? I suppose it cannot compare char and string. but how can I deal
with
> this stuff?
>
>
> <% BufferedReader in = new BufferedReader(
> new InputStreamReader(
> yc.getInputStream()));
>
> String inputLine;
>
> if ( inputLine.substring(0,1) == "1" ) {
> out.println("yes");
> }
> else {
> out.println("no");
> }
> %>
>
>
===========================================================================
> To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
> For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
DIGEST".
> Some relevant FAQs on JSP/Servlets can be found at:
>
> http://java.sun.com/products/jsp/faq.html
> http://www.esperanto.org.nz/jsp/jspfaq.html
> http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
> http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets