此方法用於使用不變區域性的大小寫規則將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。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。