Split a string into a List<string>

arrays, c#, list, split

Solution

myData.Replace(",", String.Empty).Split(';').ToList();

Problem

I am trying to split a `string` into a `List<string>`. I have this string: ``` string myData = "one, two, three; four, five, six; seven, eight, nine"; ``` And I would like the filled list of strings to look like: ``` one two three four five six seven eight nine ``` Meaning that I have to remove the commas(`,`) and the semi colons(`;`), so that for example the first row of the list, the second column will be two(without commas, semi colons or spaces). I know that I can use `.Split`: ``` string[] splittedArray = myData.Split(';').ToArray(); ``` This should produce a result like: ``` one, two, three, four, five, six, seven, eight, nine ``` How do I remove the commas(`,`) and put it in the list in that format?

Original source