I am not that familiar with Javascript, and am looking for the function that returns the UNICODE value of a character, and given the UNICODE value, returns the string equivalent. I'm sure there is something simple, but I don't see it.
Example:
- ASC("A") = 65
- CHR(65) = "A"
- ASC("ਔ") = 2580
- CHR(2580) = "ਔ"
Have a look at:
and
The first must be called on the String class (literally
String.fromCharCode...
) and will return "@" (for 64). The second should be run on a String instance (e.g.,"@@@".charCodeAt...
) and returns the Unicode code of the first character (the '0' is a position within the string, you can get the codes for other characters in the string by changing that to another number).The script snippet:
gives:
Because JavaScript uses UCS-2 internally,
String.fromCharCode(codePoint)
won’t work for supplementary Unicode characters. IfcodePoint
is119558
(0x1D306
, for the'
Example for generating alphabet array here :