c# - File.ReadLine adds line breaks to CSV -


i have been converting exported document outlook csv used interpreted c# further manipulations. problem arises when using:

    string path = @"contacts.csv";     program self = new program();     // open file read from.      var readline = file.readlines(path);     foreach (string line in readline)     {         console.writeline(line);         console.readkey(true);     } 

to display following data:

enter image description here

which not expected output, , after hitting key pass readkey rest of data displayed following: enter image description here (blanked out contact numbers)

when csv it's self not contain line breaks (used replace function using ctrl+j mimic line break , replace nothing). csv looks like:

enter image description here

there no line breaks present, problem persists throughout document on iterations not others. why there new line breaks being added , being pushed iteration, why occouring? i've exhausted possibilities within skillset


i've tried forcefully removing new line breaks

string toprint = line.replace("\n"," ");                 console.writeline(toprint);                 console.writeline("\r\n");                 console.readkey(true); 

which returns same result & actively trying out other possible solutions , updating what's been tried

open csv file notepad++ , configure display white-space characters. you'll find something. maybe file has many spaces. displayed on console black. maybe line wrapped.

your code fine. no obvious mistakes. , neither readlines nor writeline broken.


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -