如何获得字符对于给定的ASCII值 [英] How to get character for a given ascii value
本文介绍了如何获得字符对于给定的ASCII值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我怎样才能得到一个给定的ASCII code的ASCII字符。
How can I get the ascii character of a given ascii code.
例如。我在寻找,鉴于code 65将返回A的方法。
e.g. I'm looking for a method that given the code 65 would return "A".
感谢
推荐答案
你的意思是A(A 字符串
)或'A'(A 字符
)?
Do you mean "A" (a string
) or 'A' (a char
)?
int unicode = 65;
char character = (char) unicode;
string text = character.ToString();
请注意,我已经提到的Uni code,而不是ASCII因为这是C#的本地字符编码;基本上每个字符
是一个UTF-16 code点。
Note that I've referred to Unicode rather than ASCII as that's C#'s native character encoding; essentially each char
is a UTF-16 code point.
这篇关于如何获得字符对于给定的ASCII值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文