Converts a String
with a hexadecimal value to a Number
.
unhex()
converts a string with its hexadecimal number value to a number. Hexadecimal (hex) numbers are base-16, which means there are 16 unique digits. Hex extends the numbers 0–9 with the letters A–F. For example, the number 11
(eleven) in base-10 is written as the letter B
in hex.
The first parameter, n
, is the hex string to convert. For example, unhex('FF')
, returns the number 255. If an array is passed, as in unhex(['00', '80', 'FF'])
, an array of numbers is returned.
예제
구문
unhex(n)
unhex(ns)
매개변수
n
String:
value to convert.
ns
String[]:
values to convert.
Returns
Number: converted number.
Notice any errors or typos? Please let us know. Please feel free to edit src/utilities/conversion.js and open a pull request!