使用int而不是\ uNNNN打印Unicode代码指向控制台

时间:2009-09-14 21:40:58

标签: c# unicode

如果这很愚蠢,请道歉。如何打印Unicode字符,比如说\ u20ac使用整数?所以,我想传递整数8364,而不是Console.WriteLine("\u20ac");。 感谢。

1 个答案:

答案 0 :(得分:3)

只需将数字转换为代表UTF-16代码点的char

public static void PrintChar(int codePoint)
{
    Console.WriteLine((char) codePoint);
}

PrintChar(8364);
相关问题