标签:文字 cst amp hide regex 图片 toc code expr
1 using System; 2 3 public class Example 4 { 5 public static void Main() 6 { 7 bool isChinese = false; 8 string CString = "a.有能力的;出色的"; 9 for (int i = 0; i < CString.Length; i++) 10 { 11 if (Convert.ToInt32(Convert.ToChar(CString.Substring(i, 1)))< Convert.ToInt32(Convert.ToChar(128))) 12 { 13 isChinese = false; 14 } 15 else 16 { 17 isChinese = true; 18 } 19 } 20 Console.WriteLine(isChinese); 21 } 22 } 23
1 using System; 2 3 public class Example 4 { 5 public static void Main() 6 { 7 string CString = "ability"; 8 // 正则表达式 9 System.Text.RegularExpressions.Regex reg = new System.Text.RegularExpressions.Regex(@"^[A-Za-z]+$"); 10 // IsMatch 11 Console.WriteLine(reg.IsMatch(CString)); 12 } 13 } 14
判断是否是中文
isChinese = true; break;
标签:文字 cst amp hide regex 图片 toc code expr
原文地址:https://www.cnblogs.com/GoldenEllipsis/p/10624749.html