Skip to main content

Character.ToNumber

Converts a character to a number value.

Syntax

Character.ToNumber(
character as text
) as number

Remarks

Returns the number equivalent of the character.

The result will be the 21-bit Unicode code point represented by the provided character or surrogate pair.

Examples

Example #1

Convert a character to its equivalent number value.

Character.ToNumber("#(tab)")

Result:

9

Example #2

Convert the UTF-16 surrogate pair for the "grinning face" emoticon to its equivalent hexadecimal code point.

Number.ToText(Character.ToNumber("#(0001F600)"), "X")

Result:

"1F600"

Category

Text.Conversions from and to text