将字符代码转换为字符 (VB.NET)
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4857866/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Converting a character code to char (VB.NET)
提问by Freesn?w
I'm able to convert a character to its corresponding character/ASCII code using "Asc(CHAR)". What can I use to convert this returned integer back to its original character form?
我可以使用“Asc(CHAR)”将字符转换为其相应的字符/ASCII 代码。我可以使用什么将返回的整数转换回其原始字符形式?
回答by Jason Yost
回答by The Scrum Meister
Use the Chr or ChrWfunction, Chr(charNumber)
.
使用Chr 或 ChrW函数,Chr(charNumber)
。
回答by Georg
you can also use
你也可以使用
Dim intValue as integer = 65 ' letter A for instance
Dim strValue As String = Char.ConvertFromUtf32(intValue)
this doesn't requirement Microsoft.VisualBasic reference
这不需要 Microsoft.VisualBasic 参考
回答by AlexJF
You could use the Chr(int) function
您可以使用 Chr(int) 函数