I'd like to split a string with using pattern like this:
it starts and ends with '\n' and contains an arbitrary number of whitespace or '\n' in between.
Edit:
This input:
string s = "aaa\n \nbbb\n \nccc\n \n \nddd";
should result in an array containing
aaa
bbb
ccc
ddd
Given your example, string.Split will be much cleaner.
var vals = s.Split('\n', StringSplitOptions.RemoveEmptyEntries);
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