1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
function CharToHex(str) { var out, i, len, c, h; out = ""; len = str.length; i = 0; while (i < len) { c = str.charCodeAt(i++); h = c.toString(16); if (h.length < 2) { h = "0" + h; } out += "\\x" + h + " "; if (i > 0 && i % 8 == 0) { out += "\r\n"; } } return out; } |