zoukankan      html  css  js  c++  java
  • C#判断字符串中是否有中文

    //判断字符串中是否有中文,true有,false没有。
    public bool IsChina(string CString)
            {
                bool BoolValue = false;
                for (int i = 0; i < CString.Length; i++)
                {
                    if (Convert.ToInt32(Convert.ToChar(CString.Substring(i, 1))) > Convert.ToInt32(Convert.ToChar(128)))
                    {
                        BoolValue = true;
                    }
                  
                }
                return BoolValue;
            }

    //返回字符串中的中文部分
    public string IsChinaStr(string CString)
            {
                string rt = "";
                for (int i = 0; i < CString.Length; i++)
                {
                    if (Convert.ToInt32(Convert.ToChar(CString.Substring(i, 1))) > Convert.ToInt32(Convert.ToChar(128)))
                    {
                        rt += CString.Substring(i, 1).ToString();
                    }

                }
                return rt;
            }

  • 相关阅读:
    Code-Helper:RegexHelper.cs
    Code-Convert:Image to base64
    un-System.Reflection.IReflect.cs
    System.Reflection.AssemblyName.cs
    System.Reflection.ConstructorInfo.cs
    System.Attribute.cs
    ERROR<53761>
    /dev/null 文件
    linux telnet服务安装与配置
    linux定时任务2-at命令
  • 原文地址:https://www.cnblogs.com/tongdengquan/p/6090599.html
Copyright © 2011-2022 走看看