如何在 C# 中检查 Unicode 字符是否为小写字母


检查 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

更新日期:05-12-2019

148 次浏览

开启你的职业生涯

通过完成本课程获得认证

开始
广告
© . All rights reserved.