1 public bool IsChinaString(string CString) 2 { 3 bool BoolValue = false; 4 for (int i = 0; i < CString.Length; i++) 5 { 6 if (Convert.ToInt32(Convert.ToChar(CString.Substring(i, 1)))< Convert.ToInt32(Convert.ToChar(128))) 7 { 8 BoolValue = false; 9 } 10 else 11 { 12 13 return BoolValue = true; 14 } 15 } 16 17 return BoolValue; 18 19 }
页面中使用jquery判断文本框先输入的中文还是英文的判断
1 var c = $("#txtStreet").val().charCodeAt(0); 2 if (c >= 65 && c <= 90 || c >= 97 && c <= 122) { 3 4 return { 5 label: item.StreetName_EN + "," + item.StreetName1, 6 value: item.StreetName_EN + "," + item.StreetName1, 7 } 8 } else { 9 10 return { 11 label: item.StreetName1 + "," + item.StreetName_EN, 12 value: item.StreetName1 + "," + item.StreetName_EN, 13 }