That depends on where the file comes from and how it was created.
If it was created on the same system, it will most likely use the native newline combination for that specific system, and you can use the Environment.NewLine
constant:
string[] split1 = radek1.Split(new string[] { " ", Environment.NewLine }, StringSplitOptions.None);
Note that Environment.NewLine
is a string and can contain more than one character, so you need to split on strings, and the call needs a StringSplitOptions
parameter as there is no overload without it.
If the file comes from a different system (or was created with newlines typical for a different system), you would need to specify that specific string. For example the two character string used in a Windows system:
string[] split1 = radek1.Split(new string[] { " ", "\r\n" }, StringSplitOptions.None);
You can also include the most common newline combinations, if you need to handle files coming from different systems:
string[] split1 = radek1.Split(new string[] { " ", "\r\n", "\n" }, StringSplitOptions.None);