📜  C#| Char.ToLowerInvariant(Char)方法

📅  最后修改于: 2021-05-29 17:14:53             🧑  作者: Mango

此方法用于使用不变区域性的大小写规则将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

参考:

  • https://docs.microsoft.com/zh-cn/dotnet/api/system.char.tolowerinvariant?view=netframework-4.7.2