C# 中的 Char.ConvertFromUtf32(Int32) 方法
csharpserver side programmingprogramming更新于 2025/9/19 22:04:00
C# 中的 Char.ConvertFromUtf32(Int32) 方法用于将指定的 Unicode 代码点转换为 UTF-16 编码的字符串。
语法
以下是语法 −
public static string ConvertFromUtf32 (int utf32);
上面,参数 utf32 是一个 21 位 Unicode 代码点。
示例
现在让我们看一个实现 Char.ConvertFromUtf32(Int32) 方法的示例 −
using System; public class Demo { public static void Main(){ int utf = 0x0051; string str = Char.ConvertFromUtf32(utf); Console.WriteLine("Value = "+str); } }
输出
这将产生以下输出 −
Value = Q
示例
现在让我们看另一个例子 −
using System;
public class Demo {
public static void Main(){
int utf = 0x0046;
string str = Char.ConvertFromUtf32(utf);
Console.WriteLine("Value = "+str);
}
}
输出
这将产生以下输出 −
Value = F

