读书人

字符串.split的有关问题

发布时间: 2013-01-20 10:22:41 作者: rapoo

字符串.split的问题
有一个字符串
m="a='111' and b='222' and ccc>200"
现在想实现
var tmp=m.split(" and "); // tmp结果是 {"a='111'","b='222'","ccc>200"}
貌似C#中split参数不能是一个字符串,有没有替代的方法啊?
[解决办法]
string m = "a='111' and b='222' and ccc>200";
var ary = m.Split(new string[] { "and" }, StringSplitOptions.RemoveEmptyEntries);

[解决办法]
var tmp=Regex.split(m," and ");
[解决办法]

s.Split(new string[] { "and" }, StringSplitOptions.RemoveEmptyEntries);

读书人网 >C#

热点推荐