C# 字符串 包含中文
/// <summary> /// 判断字符串 是否含有中文 /// </summary> /// <param name="str"></param> /// <returns></returns> private bool ContainCHChar(string str) { int chnfrom = Convert.ToInt32("4e00", 16); int chnend = Convert.ToInt32("9fff",16); bool result = false; for (int i = 0; i <= str.Length - 1; i++) { char temp = str[i]; int charNum = Convert.ToInt32(temp); if (charNum >= chnfrom && charNum <= chnend) { result = true; break; } } return result; }