![](/img/trans.png)
[英]How to convert a hex string to a byte and a byte to a hex string in Javascript?
[英]How to convert hex numbers to byte string?
> 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);
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.