DownloadString in C# skips newline characters -
DownloadString in C# skips newline characters -
i want import text info google finance, , utilize http address parameter downloadstring http://www.google.com/finance/getprices?i=1200&p=1d&f=d,o,h,l,c,v&df=cpct&q=aapl . however, resulting string misses newline characters, hard parse. ideas?
the line ends returned stream \n
opposed default windows line ends \r\n
(which represented in environment.newline
on windows).
try split on of possible combinations of \r
, \n
:
webclient wc = new webclient(); string s = wc.downloadstring("http://www.google.com/finance/getprices?i=1200&p=1d&f=d,o,h,l,c,v&df=cpct&q=aapl"); string[] lines = s.split(new string[] { environment.newline, "\n", "\"r" }, stringsplitoptions.none);
c# downloadstring
Comments
Post a Comment