Converting ASCII and Characters

by | March 6,2009

Table of Contents

Convert ASCII value to a character

To convert the ASCII value to a character, use type casting like this:

[char]65

Convert a character to ASCII value

To do the opposite and convert a character to its ascii value, use this:

[int][char]'A'

Here, the letter “A” is first converted into a Char type, then into an Integer value.

To process more than one character at a time, use arrays instead:

[int[]][char[]]'Hello'