我想将UNICODE代码点符号如"U+1F1FA U+1F1F8"转换为"????????".
到目前为止,我在JavaScript中try 的内容是
String.fromCharCode(parseInt("U+1F1FA", 16));
但这并不管用.
我想将UNICODE代码点符号如"U+1F1FA U+1F1F8"转换为"????????".
到目前为止,我在JavaScript中try 的内容是
String.fromCharCode(parseInt("U+1F1FA", 16));
但这并不管用.
您可以使用静态方法String.fromCodePoint()
来实现这一点.
const us = String.fromCodePoint('0x1F1FA', '0x1F1F8');
console.log(us);