CharToNum

Converts a one-character string to a number (a character’s ASCII code).

Syntax

CharToNum(oneCharString)

Parameters

Parameter

Type

Description

oneCharString

string

A string of length 1 (for example, ‘a’, ‘5’)

Return

The string character’s ASCII code.

Note

In Python script, use python function ord().

Examples

Python

x = ord("1")
# x now is equal to 49

NexScript

x = CharToNum("1")
% x now is equal to 49