从字符串中找到中文

 1    private void btnSearchChinese_Click(object sender, EventArgs e)
 2         {
 3             string originalStr=originalTxt.Text;
 4             string result = "";
 5             Regex regex = new Regex("([\u4e00-\u9fa5]+)"); 
 6             for (int i = 0; i < originalStr.Length; i++)
 7             {
 8                 if (regex.IsMatch(originalStr[i].ToString()))
 9                 {
10                     result += originalStr[i].ToString();
11                 }
12             }
13             resultTxt.Text = result;
14 
15         }

winform程序写的

 

posted @ 2015-07-08 20:32  大漠孤烟~  阅读(360)  评论(0编辑  收藏  举报