Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Converting a character code to char (VB.NET)

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?

like image 394
Freesnöw Avatar asked Feb 01 '11 01:02

Freesnöw


People also ask

How do I get the ASCII value of a character in VB net?

ToByte() can be used. Convert. ToByte(character): This function will return ASCII Value of given character.

What is CHR in VB net?

The Chr function converts the specified ANSI character code to a character. Note: The numbers from 0 to 31 represents nonprintable ASCII codes, i.e. Chr(10) will return a linefeed character.

Is ASCII a character?

ASCII is a 7-bit character set containing 128 characters. It contains the numbers from 0-9, the upper and lower case English letters from A to Z, and some special characters. The character sets used in modern computers, in HTML, and on the Internet, are all based on ASCII.


1 Answers

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. 
like image 91
Jason Yost Avatar answered Sep 17 '22 13:09

Jason Yost