C#中的Char.ConvertFromUtf32(Int32)方法

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