16进制转成字符串

// 16进制转字符串
var bottomPayload = ”323230204F776E4566794246484751736F736D4F425043536C63796365696245724D59644B204D6963726F736F66742045534D5450204D41494C20536572766963652C2056657273696F6E3A20362E302E333739302E3138333020726561647920617420205475652C2032322053657020323032302031343A35333A3137202B303830300D0A323530204F776E4566794246484751736F736D4F425043536C63796365696245724D59644B2048656C6C6F205B312E3135302E322E37395D0D0A32353020322E312E30205A423872613674385971445759533759706335534540655674624872772E6564752E2E2E2E53656E646572204F4B0D0A32353020322E312E352047346F41526B50404F776E4566794246484751736F736D4F425043536C63796365696245724D59644B2E6F72670D0A333534205374617274206D61696C20696E7075743B20656E642077697468203C43524C463E2E3C43524C463E0D0A32353020322E362E30203C4D41494C715533646339356E5A6D546D33746230644B656347774638404F776E4566794246484751736F736D4F425043536C63796365696245724D59644B3E20517565756564206D61696C20666F722064656C69766572790D0A“

const payloadBottomString = () => {
if (bottomPayload.length > 0) {
if (bottomPayload.length % 2 !== 0) {
message.error(‘必须为偶数’);
return ‘’;
}
let temp;
let arr = [];
for (let i = 0; i < bottomPayload.length; i = i + 2) {
temp = parseInt(bottomPayload.substr(i, 2), 16);
arr.push(String.fromCharCode(temp));
}
setPayload2s(arr.join(‘’))
console.log(‘string’, arr.join(‘’))
}
}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值