java - Extra Carriage Returns while reading CSV -
I have some CSV files that I am trying to use Java. For the first time I send a line from the CSV file and send it to another method for processing with the following code: ( The output of the above code is: Where should the output be: What is actually happening and where is this additional carriage return (\ r) coming from Regex is set up appropriately? The following regex will match one or more new lines or a carous return; Just set the overhead regs as a delimiter; it changes the
TempFile); Scanner scanner = new scanner (csvFile); Scanner.useDelimiter ("[\ n \ r]"); Scanner.next (); While (scanner.hasNext ()) {string temp = scanner.next (); Println (temporary); // datastorage.enterRow (temp); }}
A AI277 | DEL | MUB | 05-12-2013 | 0600 | 4.10 | 5500 | Y | EB AI279 | MAB | 10-12-2013 | 0630 | 4.30 | 4900 | Y E AI289 | MAB | 10-12-2013 | 0830 | 4.00 | 5650 | Y EB AI278 | DEL | MUB | 17-12-2013 | 1830 | 4.20 | 5300 Y E AI278 | DL | Mub | 20-12-2013 | 1430 | 3.45 | 6500 | En | EB
A AI277 | DEL | MUB | 05-12-2013 | 0600 | 4.10 | 5500 | Y EB AI279 | DEL | MUB | 10-12-2013 | 0630 | 4.30 | 4900 | Y E AI28 9 | DL | Mub | 10-12-2013 | 0830 | 4.00 | 5650 | Y EB AI278 | DL | Mub | 17-12-2013 | 1830 | 4.20 | 5300 Y E AI278 | DEL | MUB | 20-12-2013 | 1430 | 3.45 | 6500 | En | EB
"[\ N \ r] + "
scanner.useDelimiter (" [\ n \ r \ "]); From the line
scanner.useDelimiter ("[\ n \ r] +");
Comments
Post a Comment