GDScript3
5 行
//字符串转ascii码,用charCodeAt();
//ascii码转字符串,用fromCharCode();
var str = "A";
var code = str.charCodeAt();
var str2 = String.fromCharCode(code);

十进制转二进制

GDScript3
3 行
var a = "i";
console.log(a.charCodeAt()); //105
console.log(a.charCodeAt().toString(2)); //1101001
GDScript3
3 行
var a = "我";
console.log(a.charCodeAt()); //25105
console.log(a.charCodeAt().toString(2)); //110001000010001
GDScript3
4 行
var a = "我们";
console.log(a.length); //2
var list = a.split("");
console.log(list.length); //2<br>console.log(a.charCodeAt().toString(2)); //110001000010001 100111011101100