Advertisement

04.29.2008 at 08:32AM PDT, ID: 23362399
[x]
Attachment Details

JAVA file IO gives strange string that prints out normally, but can not pass to functions.

Asked by gzmask in New to Java Programming, Java AWT & Swing

Tags: java

Hello guys, I use the JAVA file IO to read from a CSV file and I use a CSV phaser to delimit it.
the result I got looks normal but I can not pass them to functions. here I included the code to give the wired string a test, and the result is always "Not the Same" when I print both strings and they appear to be exactly the same.Start Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
FileReader input = null;        
        String ProblemString1;
        try{
            input = new FileReader("test.csv");
            int code;
            do{
                String CSVLine = null;
                while((code=input.read())!= -1)
                {
                    if ((char)code == '\n')
                        break;
                    CSVLine += (char)code;                    
                }
 
 
                CSV parser = new CSV();
                List list = parser.parse(CSVLine);
                Iterator it = list.iterator();            
                ProblemString1= it.next(); //the result is "Something"
                
                String NormalString= "Something"; //this is exactly the same with the ProblemString1
                if (ProblemString1.equals(NormalString))
                    System.out.println("Same");
                else
                    System.out.println("Not The Same");
 
Loading Advertisement...
 
[+][-]04.29.2008 at 08:39AM PDT, ID: 21463283

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04.29.2008 at 08:40AM PDT, ID: 21463294

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: New to Java Programming, Java AWT & Swing
Tags: java
Sign Up Now!
Solution Provided By: aiklamha
Participating Experts: 1
Solution Grade: A
 
 
[+][-]04.29.2008 at 08:45AM PDT, ID: 21463352

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04.29.2008 at 08:48AM PDT, ID: 21463390

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04.29.2008 at 08:53AM PDT, ID: 21463432

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04.29.2008 at 08:56AM PDT, ID: 21463457

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04.29.2008 at 08:58AM PDT, ID: 21463482

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04.29.2008 at 09:00AM PDT, ID: 21463506

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04.29.2008 at 09:01AM PDT, ID: 21463512

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04.29.2008 at 09:01AM PDT, ID: 21463515

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04.29.2008 at 09:02AM PDT, ID: 21463528

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628