程晓晖

博客园 首页 新随笔 联系 订阅 管理

    public string  allChinaChar(string text)
    {
        string returnstr = "";
        foreach (char c in text.ToCharArray())
        {
            //去掉标点符号
            //if (!char.IsPunctuation(c))
            //{
            //    returnstr += c.ToString();
            //}
            //只取汉字
            if (Regex.IsMatch(c.ToString(), @"^[\u4e00-\u9fa5]+$") == true)
            {
                returnstr += c.ToString();
            }
          
        }
        return returnstr;
    }

posted on 2010-11-11 15:46  fumen  阅读(408)  评论(0编辑  收藏  举报