Home > Web Front-end > JS Tutorial > JavaScript conversion method between hexadecimal numbers and ASCII characters

JavaScript conversion method between hexadecimal numbers and ASCII characters

高洛峰
Release: 2017-01-09 14:40:54
Original
3176 people have browsed it

As shown below:

var hex="0x29";//十六进制
var charValue = String.fromCharCode(hex);//生成Unicode字符
var charCode = charValue.charCodeAt(0);//获取指定字符的十进制表示.
var hexOri="0x"+charCode.toString(16);;//将int值转换为十六进制
alert("hex:"+hex+"\ncharValue:"+charValue+"\ncharCode:"+charCode+"\nhexOri:"+hexOri);
Copy after login

The above is the conversion method between javascript hexadecimal numbers and ASCII characters brought to you by the editor. Content, I hope everyone will support the PHP Chinese website~

For more articles related to the conversion method between javascript hexadecimal numbers and ASCII characters, please pay attention to the PHP Chinese website!


Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template