如何在c#win中将Unicode编号转换为字符串。形成
问题描述:
我有一个unicode号码 U + 2602
,如何将其转换为特定符号或字符串,然后再将其转换回unicode号码? 以上unicode号码的符号是: - (请参阅下面的链接)
https://www.dropbox.com/s/9n8v8rs383he7e3/Unicode%20answer.png [ ^ ]
I have a unicode number "U+2602
", how to convert it into it's particular symbol or charachter and then again convert it back to unicode number? Symbol of the above unicode number is :- (Please see in the link below)
https://www.dropbox.com/s/9n8v8rs383he7e3/Unicode%20answer.png[^]
答
char myValue = Char.Parse("\u2602");
转换回字符串
convert back to string
string str = string.Format(@"\u{0:x4}", (int)myValue);
if你需要字符串
if you need string
string myValue = Char.Parse("\u2602").ToString();