我正在尝试将一个 string
拆分成一个 List<string>
。我有这个字符串:
string myData = "one, two, three; four, five, six; seven, eight, nine";
我希望填充的字符串列表看起来像这样:
one two three
four five six
seven eight nine
意味着我需要去除逗号(
,
)和分号(;
),例如列表的第一行第二列将是两个(没有逗号、分号或空格)。我知道可以使用
.Split
:string[] splittedArray = myData.Split(';').ToArray();
这应该会产生以下结果:
one, two, three,
four, five, six,
seven, eight, nine
如何去掉逗号(
,
)并以该格式将其放入列表中?