C# 判断整个字符串是否都是中文

        /// <summary>
        /// 判断字符串全部是否是中文。返回true 则表示含有非中文
        /// </summary>
        /// <param name="str_chinese"></param>
        /// <returns></returns>
        public bool IsChinese(string str_chinese)
        {
            bool b = false;
            for (int i = 0; i < str_chinese.Length; i++)
            {
                Regex reg = new Regex(@"[\u4e00-\u9fa5]");
                if (!reg.IsMatch(str_chinese[i].ToString()))
                {

                    b = true;
                    break;
                }
            }

            return b;

        }

  

posted @ 2014-09-16 22:59  albertwmm  阅读(1333)  评论(0编辑  收藏  举报