方法一:
//判断字符串中是否有中文,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 bool WordsIScn(string words){string TmmP;for (int i = 0; i < words.Length; i++){TmmP = words.Substring(i, 1);byte[] sarr = System.Text.Encoding.GetEncoding("gb2312").GetBytes(TmmP);if (sarr.Length == 2){return true;}}return false;}
转载于:https://www.cnblogs.com/vibratea/archive/2010/09/15/1826759.html