Converts a single-character String
to a Number
.
unchar()
converts single-character strings to their corresponding integer (whole number).
The parameter, n
, is the character to convert. For example, unchar('A')
, returns the number 65. If an array is passed, as in unchar(['A', 'B', 'C'])
, an array of integers is returned.
Examples
Syntax
unchar(n)
unchar(ns)
Parameters
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!