Anthony Jones skrev:
"AMP" <am******@gmail.comwrote in message
news:77**********************************@u69g2000 hse.googlegroups.com...
>Hello,
I am trying to split a string at the newline and this doesnt work:
String[] Channel = FileName.Split("\r");
Try:-
String[] Channel = FileName.Split('\r');
To be sure use \n instead of \r because newlines in a text file created
on a unix/linux system a text line is terminated by a single "\n", while
in DOS/Windows it is "\r\n".
String[] Channel = FileName.Split('\n');
Secondly: If the text line is from a DOS/Windows text file you still
have to remove the remaining \r or \n depending on what separator you
use in the split statement.
String arg0 = Channel[0].trim("\r\n");
and so on....
Personally I ended up in implementing this function:
public static String[] Str2Lines(String s, int optional_max_count)
--
Bjørn Brox