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.