asp.net 怎么提取一个字符串中的所有中国字 比如说string str="adasdasdasdas天天>>"@#@!#!@天";我想吧 '天天天' 提取出来 当然不一定是'天天天'这两个字 只是举个例子 也不知道中国字的确切位置 咋提取中国字呢 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 http://www.cnblogs.com/alronzhang/archive/2010/02/14/1668316.html 正则啊 string x = @"[\u4E00-\u9FFF]+"; string str="adasdasdasdas天天>>"@#@!#!@天"; MatchCollection Matches = Regex.Matches(str, x, RegexOptions.IgnoreCase); StringBuilder sb = new StringBuilder(); foreach (Match NextMatch in Matches) { sb.Append(NextMatch.Value); } return sb.ToString(); static void Main(string[] args) { string str="adasdasdasdas天天>>天"; StringBuilder sb = new StringBuilder(); Regex re = new Regex("[\\u4e00-\\u9fa5]+", RegexOptions.None); MatchCollection mc = re.Matches(str); foreach (Match ma in mc) { sb.Append(ma.Value); } Console.WriteLine(sb.ToString()); Console.ReadLine(); } "[\\u4e00-\\u9fa5]+这一串是中文字符的编码范围么 static void Main(string[] args) { string str="我心依然是中国心xoxo"; StringBuilder sb = new StringBuilder(); Regex re = new Regex("[\\u4e00-\\u9fa5]+", RegexOptions.None); MatchCollection mc = re.Matches(str); foreach (Match ma in mc) { sb.Append(ma.Value); } Console.WriteLine(sb.ToString()); Console.ReadLine(); } .NET如何记录文件路径呢? asp.net面包屑导航和下载的问题!(急) cs代码下的确认提示 .net平台与vss整合怎么撤销! 关于LinkButton控件的问题!急,在线等! 如何取行Gridview的Itemtemplate中LinkButton的文本值? 大家的asp.net界面设计用的是什么工具?????? c#中创建文件流(System.IO.FileStream)出错 请问如何相互对三层的信息进行引用,朋友们帮帮我 急啊谢谢了 卸载IIS重新安装后出现页面无法显示问题! 有没有办法把这个东西改为相对路径 连接不了数据库【在线】
string str="adasdasdasdas天天>>"@#@!#!@天";
MatchCollection Matches = Regex.Matches(str, x, RegexOptions.IgnoreCase);
StringBuilder sb = new StringBuilder();
foreach (Match NextMatch in Matches)
{
sb.Append(NextMatch.Value);
}
return sb.ToString();
{
string str="adasdasdasdas天天>>天";
StringBuilder sb = new StringBuilder();
Regex re = new Regex("[\\u4e00-\\u9fa5]+", RegexOptions.None);
MatchCollection mc = re.Matches(str);
foreach (Match ma in mc)
{
sb.Append(ma.Value);
}
Console.WriteLine(sb.ToString());
Console.ReadLine();
}
static void Main(string[] args)
{
string str="我心依然是中国心xoxo";
StringBuilder sb = new StringBuilder();
Regex re = new Regex("[\\u4e00-\\u9fa5]+", RegexOptions.None);
MatchCollection mc = re.Matches(str);
foreach (Match ma in mc)
{
sb.Append(ma.Value);
}
Console.WriteLine(sb.ToString());
Console.ReadLine();
}