Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | 2x 1x 1x 2x 2x 1x | /** * 16进制字符串转ASCII字符串 * @method util/hexToAsc * @param {String} str 需要转换的16进制字符串 * @returns {String} ASCII字符串 * @example * var $hexToAsc = require('@spore-ui/kit/packages/util/hexToAsc'); * $hexToAsc(); // => '' * $hexToAsc('2a2b'); // => '*+' */ function hexToAsc(hex) { if (!hex) { return ''; } return hex.replace(/[\da-f]{2}/gi, function (match) { var int = parseInt(match, 16); return String.fromCharCode(int); }); } module.exports = hexToAsc; |