如何将字符转换为ASCII中的相关整数或C#中的unicode? [英] How to convert a character to its relevant integer in ASCII or unicode in C#?
问题描述
受人尊敬的人,
我在C#中遇到问题。如何在c#中将字符转换为ASCII / Unicode等效字符?感谢患者的听证会,并对造成的滋扰感到非常抱歉。
我尝试了什么:
我试过Convert.ToChar()。但遗憾的是它无法正常工作。
Quote:如何转换c#中的ASCII / Unicode等效字符?
C#中的字符类型已经是Unicode字符 - C#全是Uncode,有16位宽的字符。
如果你的意思是一个字符的整数,那么就把它投出来:
char a =( char ) 97 ;
char A =( char ) 65 < /跨度>;
Respected People,
I have a problem in C#. How to convert a character to its ASCII/Unicode equivalent in c#?Thanks for the patient hearing and very sorry for the nuisance caused.
What I have tried:
I tried Convert.ToChar(). But unfortunately it is not working properly.
Quote:How to convert a character to its ASCII/Unicode equivalent in c#?
A char type in C# is a Unicode character already - C# is all Uncode, with 16 bit wide characters.
If you mean an integer number to a char then just cast it:
char a = (char) 97; char A = (char) 65;
这篇关于如何将字符转换为ASCII中的相关整数或C#中的unicode?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!