PDA

View Full Version : coversion ASCII to Letter and Letter to ASCII


solal
11-26-2002, 08:36 AM
I do have one letter. Iwant to convert it to ASCII Code and to
make a Math operation on this number. After that I want to
Convert the result (a valid Ascii number..) to letter/
What are the methodes of the conversion in both ways?

Thanks.

glenngv
11-26-2002, 08:44 AM
don't make many posts of the same problem! :mad:

your question has been answered in these threads:

http://codingforums.com/showthread.php?s=&threadid=10264
http://codingforums.com/showthread.php?s=&threadid=10321

beetle
11-26-2002, 04:26 PM
Solal, are you confused by the difference between functions and methods? A method is just a function that is attached to a data-object, in this case, any String-type variable. You enact a method in javascript with dot-syntax separation. I this case, the two methods you need are fromCharCode and charCodeAt. You will notice that fromCharCode is a method to the String datatype.

var myASCII = "98";
var myLetter = String.fromCharCode(myASCII);
// myLetter now equals 'b'

var myASCII_two = myLetter.charCodeAt(0);
// mySCII_two now equals 98

krycek
11-26-2002, 11:58 PM
OMG I cannot believe it... this is his THIRD THREAD on this! :eek:

...sometimes you wonder if they do it to wind you up, or if they really don't know what is going on.

::] krycek [::