[英]How to convert hex string to hex number in nodejs
I have: "#ffd900"
in string and I would like to convert to number 0xffd900
.我有: "#ffd900"
字符串,我想转换为数字0xffd900
。
How can I do it?我该怎么做?
You must remove the first character and then convert to int using the parseInt
function您必须删除第一个字符,然后使用parseInt
function 转换为 int
parseInt(a.split("#")[1],16)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.