VBScript Chr Function

Definition and Usage

The Chr function can convert a specified ANSI character code to a character.

Note:Numbers from 0 to 31 represent non-printable ASCII codes. For example, Chr(10) returns a newline character.

Syntax

Chr(charcode)
Parameter Description
charcode A number that identifies a character. It is necessary to identify a character.

Instance

Example 1

document.write(Chr(65))
document.write(Chr(97))

The outputs are as follows:

A
a

Example 2

document.write(Chr(37))
document.write(Chr(45))

The outputs are as follows:

%
-

Example 2

document.write(Chr(50))
document.write(Chr(35))

The outputs are as follows:

2
#