如何在C#中将Unicode字符(\ u)与其他变量连接在一起? [英] How can I concatenate Unicode character (\u) with other variables in C#?
本文介绍了如何在C#中将Unicode字符(\ u)与其他变量连接在一起?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要像这样连接Unicode字符
int num = 1200;
字符串str =" \ u" + num;
txtUnicode.Text = str;
但没有用,有人可以帮我吗?
:((
I need to concatenate Unicode character like this
int num=1200;
string str="\u"+num;
txtUnicode.Text=str;
but it didn’t work can any one help me out?
:((
推荐答案
尝试此 [ ^ ]
您可以使用
txtUnicode.Text = "\u1200";
记住\ u参数是十六进制,而不是十进制,因此对于Yen符号,您将希望使用"\ u04b0",而不是"\ u1200" .
但是,如果需要将变量int转换,则
Remember that the \u argument is hexadecimal, not decimal, so for the Yen symbol, you will want "\u04b0", not "\u1200".
But if you need a variable int converted, then
txtUnicode.Text = ((char)num).ToString();
将起作用.笨拙,但可以.
will work. Clumsy, but it works.
这篇关于如何在C#中将Unicode字符(\ u)与其他变量连接在一起?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文