求助如何匹配标点符号 在一个输入框中输入多个名字时,客户可能会用不同的符号来分隔,如下示例:张三、李四张三,李四张三。李四张三,李四张三/李四标点符号不同,且分中文和英文两种形式。现在需要分隔这些名字,来和数据库中存在的记录做比较,看有没有重复记录。求助:如何分隔这些名字? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 char[] sep={',',',','/','.','。','、'};string[] strs="张三/李四".Split(separator, StringSplitOptions.RemoveEmptyEntries);//得到一个数组,0元素为"张三",1元素为"李四",下面你该干嘛干嘛吧 char[] separator={',',',','/','.','。','、'};string[] strs="张三/李四".Split(separator, StringSplitOptions.RemoveEmptyEntries); 只要名字不会出现英文,就可以用这个正则表达式把名字匹配出来[\u4e00-\u9fa5]* StringCollection resultList = new StringCollection();try { Regex regexObj = new Regex(@"[\u4e00-\u9fa5]*"); Match matchResult = regexObj.Match("张三、李四"); while (matchResult.Success) { resultList.Add(matchResult.Value); matchResult = matchResult.NextMatch(); } } catch (ArgumentException ex) { // Syntax error in the regular expression} 两个checkbox互斥的问题 HTTP 错误 401.3 - 未经授权:访问由于 ACL 对所请求资源的设置被拒绝。 服务器上asp.net aspx的网站都打不开了 大家帮我解决一个错误!!! 怎么判断用户名字在数据库中存在~~~ 转移数据问题 success: function(msg)函数问题 请教:bt3.btchina.net中这样的表格效果是怎么做出来的啊? 在线等:链接oracle数据库的语句 vs2005 beta版framework的IIS的发布的困惑??????? 页面保存的问题! 名词解释 如何显示分月份显示最近半年的销售和点击量?
string[] strs="张三/李四".Split(separator, StringSplitOptions.RemoveEmptyEntries);
//得到一个数组,0元素为"张三",1元素为"李四",下面你该干嘛干嘛吧
string[] strs="张三/李四".Split(separator, StringSplitOptions.RemoveEmptyEntries);
try {
Regex regexObj = new Regex(@"[\u4e00-\u9fa5]*");
Match matchResult = regexObj.Match("张三、李四");
while (matchResult.Success) {
resultList.Add(matchResult.Value);
matchResult = matchResult.NextMatch();
}
} catch (ArgumentException ex) {
// Syntax error in the regular expression
}