用字符串C#.net 1.1.4322分割字符串(Splitting string with string C# .net 1.1.4322)
如何在C#.net 1.1.4322中用字符串拆分字符串?
字符串示例:
Key|Value|||Key|Value|||Key|Value|||Key|Value需要:
Key|Value Key|Value Key|Value我不能使用RegEx.Split,因为分隔符是||| 并且分开获取每个角色。
我不能在.net 1.1中使用String.Split()重载
接受的解决方案示例:
using System.Text.RegularExpressions; String[] values = Regex.Split(stringToSplit,"\\|\\|\\|");How do I split a string with a string in C# .net 1.1.4322?
String example:
Key|Value|||Key|Value|||Key|Value|||Key|Valueneed:
Key|Value Key|Value Key|ValueI cannot use the RegEx.Split because the separating character is the ||| and just get every character separately.
I cannot use the String.Split() overload as its not in .net 1.1
Example of Accepted solution:
using System.Text.RegularExpressions; String[] values = Regex.Split(stringToSplit,"\\|\\|\\|");最满意答案
怎么样使用@“\ | \ | \ |” 在你的Regex.Split电话? 这使得| 字符文字字符。
What about using @"\|\|\|" in your Regex.Split call? That makes the | characters literal characters.
更多推荐
发布评论