Click to See Complete Forum and Search --> : convert an integer to an ascii character


AJ0622
08-08-2003, 04:33 PM
In C++, we can do the following and get the same result:

char c = 65;
//or
char ch = 'A';
//or
char cha = (char)65;

In JavaScript, is there any way we can convert an integer to an ascii character?

Thanks.

Charles
08-08-2003, 05:09 PM
alert(String.fromCharCode(65))

See http://devedge.netscape.com/library/manuals/2000/javascript/1.3/reference/string.html#1225094.

Alien Man
08-08-2003, 05:15 PM
byteToString(num) comes to mind but I may be incorrect.:o

Mr J
08-08-2003, 05:16 PM
Not sure if this is any help


String.fromCharCode(65) returns the letter A



The following example returns 65, the ISO-Latin-1 codeset value for A.

"ABC".charCodeAt(0)