java.lang.NumberFormatException while reading file input -


file folderpathfile = new file("c:\\users\\ali\\desktop\\folderpath.txt");       bufferedreader reader = new bufferedreader(new filereader(folderpathfile));     string line = reader.readline();     while(line != null){         folderspath.add(line);         line = reader.readline();     }     reader.close();       string linedup = line.tostring();         string[] linesplits = linedup.split(",");           string[] array = linesplits[1].trim().split(" ");         for(int =0; i<array.length;i++) {             int fr = integer.parseint(array[i]);             system.out.println(fr);//its printing         }          int fr1 = integer.parseint(linesplits[0]);         system.out.println(fr1); }                                             

my problem when run code i've java.lang.exception: java.lang.numberformatexception: input string: "900"

input i'm giving i.e myfile data 900, 200 300 400 500 600

why 900 i'm getting such error ?

check linesplit[0] length if it's 4 there invisible character i.e zero width no-break space . it's hard detect it's invisible , trimming won't delete character. if need rid of character

edit: saying it's length 4. try linesplits[0].replace(u'\ufeff', '') or can write number instead of copying somewhere

you can check long discussion character here on so question though it's regarding html makes sense how character comes , all


Comments