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

更新于: 2019-11-06

326 浏览

开启您的 职业 生涯

完成此课程获得认证

立即开始
广告
© . All rights reserved.