Converting a character code to char (VB.NET)
203,029
Solution 1
The Chr
function in VB.NET converts the integer back to the character:
Dim i As Integer = Asc("x") ' Convert to ASCII integer.
Dim x As Char = Chr(i) ' Convert ASCII integer to char.
Solution 2
Use the Chr or ChrW function, Chr(charNumber)
.
Solution 3
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
Solution 4
You could use the Chr(int) function
Author by
Freesnöw
Updated on February 27, 2020Comments
-
Freesnöw about 4 years
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?
-
Freesnöw about 13 yearsThank you, I'll give it a try. This sounds exactly like what I need :D