Computer >> Hướng Dẫn Máy Tính >  >> Lập Trình >> C#

Phương thức Char.ToLowerInvariant(Char) trong C#

Phương thức Char.ToLowerInvariant() trong C# chuyển đổi ký tự Unicode thành chữ thường tương đương theo quy tắc casing của culture bất biến (invariant culture).

Cú pháp

public static char ToLowerInvariant(char ch);

Tham số ch là ký tự Unicode cần chuyển đổi.

Ví dụ 1

using System;
public class Demo
{
    public static void Main()
    {
        char ch = 'D';
        char res = Char.ToLowerInvariant(ch);
        Console.WriteLine("Value = " + ch);
        Console.WriteLine("Lowercase Equivalent = " + res);
    }
}

Đầu ra

Value = D
Lowercase Equivalent = d

Ví dụ 2

using System;
public class Demo
{
    public static void Main()
    {
        char ch = 'p';
        char res = Char.ToLowerInvariant(ch);
        Console.WriteLine("Value = " + ch);
        Console.WriteLine("Lowercase Equivalent = " + res);
    }
}

Đầu ra

Value = p
Lowercase Equivalent = p