javascript(js) int(value) to Unicode ‘\uxxxx’ value
javascript(js) int(value) to Unicode ‘\uxxxx’ value
資料來源: https://stackoverflow.com/questions/6164838/is-there-an-easier-way-to-convert-an-int-to-unicode
原問題:
I'm currently doing a big switch statement in my javascript to convert
case 176: char = '\u00B0'; break;
case 177: char = '\u00B1'; break;
case 178: char = '\u00B2'; break;
case 179: char = '\u00B3'; break;
case 180: char = '\u00B4'; break;
正解:
var stringVar = String.fromCharCode(intVar);