เมธอด Char.ConvertFromUtf32(Int32) ใน C# ใช้แปลงจุดรหัส Unicode (Unicode code point) ที่ระบุเป็นสตริงที่เข้ารหัส UTF-16
ไวยากรณ์
public static string ConvertFromUtf32 (int utf32);
พารามิเตอร์ utf32 คือจุดรหัส Unicode 21 บิต
ตัวอย่าง
ตัวอย่างที่ 1: แปลง 0x0051 (ตัวอักษร 'Q')
using System;
public class Demo {
public static void Main(){
int utf = 0x0051;
string str = Char.ConvertFromUtf32(utf);
Console.WriteLine("Value = " + str);
}
}
ผลลัพธ์
Value = Q
ตัวอย่างเพิ่มเติม
ตัวอย่างที่ 2: แปลง 0x0046 (ตัวอักษร 'F')
using System;
public class Demo {
public static void Main(){
int utf = 0x0046;
string str = Char.ConvertFromUtf32(utf);
Console.WriteLine("Value = " + str);
}
}
ผลลัพธ์
Value = F