|
|
1
5
拆分以下正则表达式:
它意味着匹配既没有前面也没有后面的分号的分号。 例如,此代码
生成以下输出: [entry] [entry2] [entry3] [entry4] [] 最后一个空字段是输入末尾分号的结果。
如果分号是
终止符
在每个字段的末尾,而不是在连续字段之间使用分隔符,然后使用
得到 [entry] [entry2] [entry3] [entry4] |
|
|
2
1
为什么不使用
string sInput = "Entry1;entry2;entry3;entry4";
string[] sEntries = sInput.Split(';');
// Do what you have to do with the entries in the array...
希望这有帮助, 最好的问候, 汤姆。 |
|
|
3
1
正如Tommieb75所写,您可以使用
结果将只包含以下4个元素:
|