I've got a text box control on a page and I want people to add URLs, one on each line and then split those URLs into an array.
So, I'm trying to split them on the newline character. I've tried:
.split(Environment.Newline)
.split('vbcrlf')
.split(vbcrlf)
.split((char)Environment.Newline)
but all to no avail. What am I doing wrong?
.split(new []{Environment.Newline}, StringSplitOptions.None);
This is because Environment.Newline
is a string, so you must pass it in as an array of strings, as the function overload requires, also there needs to be a StringSplitOptions
value included. This can either be StringSplitOption.None
or StringSplitOption.RemoveEmptyEntries
.
"\r\n" is the string representation
\r = carriage return \n = line feed
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With