打印Unicode代码点使用\uNNNN的INT这一翻译安慰 [英] Printing Unicode code point to console using int intead of \uNNNN

查看:202
本文介绍了打印Unicode代码点使用\uNNNN的INT这一翻译安慰的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

道歉,如果这是愚蠢的。如何打印Unicode字符,说\\\€使用整数?所以,相反的Console.WriteLine(\\\€); ,我想通过整数8364.
谢谢

apologies if this is silly. How do I print a Unicode character, say \u20ac using an integer? So, instead of Console.WriteLine("\u20ac");, I would like to pass the integer 8364. Thanks.

推荐答案

只投数字符表示一个UTF-16代码点:

Just cast the number to char which represents a UTF-16 code point:

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

PrintChar(8364);

这篇关于打印Unicode代码点使用\uNNNN的INT这一翻译安慰的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆