Friday, 13 September 2013

C# - Split string by lines?

C# - Split string by lines?

Let's say, for example, I have the following string downloaded from a .txt
file in the web.
line1
line2
line3
How can I split the whole string by lines, so I can use splitted[0] to get
line1, splitted[1] to get line 2, etc..? Thanks!
Can I use?
string[] tokens = Regex.Split(input, @"\r?\n|\r");
Thanks

No comments:

Post a Comment