there are errors with this - but ultimately the easiest way would be to use
string s = [yourlongstring]; string[] values = s.Split(',');
If the number of commas and entries is not important, and you want to get rid of the "empty" values, you can use
string[] values = s.Split(",".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
However, one thing is that it will contain spaces before and after your lines. You can use some Linq magic to solve this problem:
string[] values = s.Split(',').Select(sValue => sValue.Trim()).ToArray();
This is if you are using .Net 3.5, and you have a System.Linq declaration at the top of the source file.
Andras Zoltan Feb 10 '10 at 9:36 2010-02-10 09:36
source share