此方法用于使用不变区域性的大小写规则将Unicode字符的值转换为其小写形式。
用法:
public static char ToLowerInvariant (char c);
在这里,c是要转换的Unicode字符。
返回值:如果c已经小写或不是字母,则此方法返回c参数的小写等效项或c的不变值。
以下示例程序旨在说明Char.ToLowerInvariant(Char)方法的用法:
示例1:
// C# program to demonstrate 
// Char.ToLowerInvariant() 
// Method 
using System; 
  
class GFG { 
  
    // Main Method 
    public static void Main() 
    { 
        // calling get() Method 
        get('A'); 
        get('a'); 
        get('B'); 
        get('b'); 
    } 
  
    // Defining get() method 
    public static void get(char c) 
    { 
  
        // getting Unicode character 
        // using ToLowerInvariant() Method 
        char val = Char.ToLowerInvariant(c); 
  
        // display the char value 
        Console.WriteLine("The lowercase equivalent"+ 
                       " of the {0} is {1}", c, val); 
    } 
}
输出:
The lowercase equivalent of the A is a The lowercase equivalent of the a is a The lowercase equivalent of the B is b The lowercase equivalent of the b is b
示例2:
// C# program to demonstrate 
// Char.ToLowerInvariant() 
// Method 
using System; 
  
class GFG { 
  
    // Main Method 
    public static void Main() 
    { 
        // declaring and initializing char variable 
        char c = 'A'; 
  
        // getting Unicode character 
        // using ToLowerInvariant() Method 
        char val = Char.ToLowerInvariant(c); 
  
        // display the char value 
        Console.WriteLine("The lowercase equivalent"+ 
                       " of the {0} is {1}", c, val); 
    } 
}
输出:
The lowercase equivalent of the A is a
参考:
相关用法
- C# DateTimeOffset.Add()用法及代码示例
 - C# String.Contains()用法及代码示例
 - C# Math.Sin()用法及代码示例
 - C# Math.Cos()用法及代码示例
 - C# Dictionary.Add()用法及代码示例
 - C# Math.Tan()用法及代码示例
 - C# Math.Abs()方法用法及代码示例
 - C# Math.Exp()用法及代码示例
 - C# Math.Abs()函数用法及代码示例
 
注:本文由纯净天空筛选整理自RohitPrasad3大神的英文原创作品 C# | Char.ToLowerInvariant(Char) Method。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。
