> str = '\xae\xee'
'®î'
如何将 [0xae, 0xee] 转换为 '®î'?
最佳答案
您可以使用 String.fromCharCode()
通过 .map()
和 .join()
将十六进制值转换为其字符串表示形式> 形成字符串:
const hex = [0xae, 0xee];
const res = hex.map(s => String.fromCharCode(s)).join('');
console.log(res);
关于javascript - 如何将十六进制数字转换为字节字符串?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59134300/