1 person found this helpful
How do you convert a letter to Hex? I missed that class
El 15/05/2009, a las 18:59, Miggl <email@example.com> escribió:
I would like to convert letters to their hex equivalents. Is there a
function that can do this in FLEX?
For example, the following string "MyNameIsEarl" should come out to
See this table: http://www.asciitable.com/
Note the Hx column. For example A is 41 in 'Hex', and L is 4C.
Using [string].charCodeAt(x) gives me the Unicode character code. I was hoping there was something similar that gave me the hex code.
Bah! The answer was right in front of my eyes!
Alert.show("String: 'A'\nASCII: " + ("A").charCodeAt(0).toString() + "\nHex: " + ("A").charCodeAt(0).toString(16));
It appears that toString() has a 'hidden' parameter when used with numbers where you can specify the base. Of course hex is base-16 (decimal, default, is base-10).
Thanks for rubberducking me, Michael!