Chinaunix首页 | 论坛 | 博客
  • 博客访问: 195386
  • 博文数量: 52
  • 博客积分: 2010
  • 博客等级: 大尉
  • 技术积分: 570
  • 用 户 组: 普通用户
  • 注册时间: 2007-09-09 22:20
文章分类

全部博文(52)

文章存档

2009年(9)

2008年(27)

2007年(16)

我的朋友

分类: C/C++

2008-07-01 20:54:22

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
 
namespace ConsoleApplication
{
    class Program
    {
        static void Main(string[] args)
        {
            string str = "fdsa汉jklfda字ljklfdsa提jkflds取ljfjkds";
            string newstr = "";
            Regex rg = new Regex(@"[\u4e00-\u9fa5]");
            for (int ii = 0; ii < str.Length; ii++)
            {
                string val = str.Substring(ii, 1);
                if (rg.IsMatch(val))
                {
                    newstr += val;
                }
            }
            Console.WriteLine(newstr);
            Console.Read();
        }
    }
}
阅读(645) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~