要检查Unicode字符是否为小写字母,代码如下-
using System; public class Demo { public static void Main() { bool res; char val = 'K'; Console.WriteLine("Value = "+val); res = Char.IsLower(val); Console.WriteLine("Is the value a lowercase letter? = "+res); } }
输出结果
这将产生以下输出-
Value = K Is the value a lowercase letter? = False
让我们看另一个例子-
using System; public class Demo { public static void Main() { bool res; char val = 'd'; Console.WriteLine("Value = "+val); res = Char.IsLower(val); Console.WriteLine("Is the value a lowercase letter? = "+res); } }
输出结果
这将产生以下输出-
Value = d Is the value a lowercase letter? = True