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 Required. A number that identifies a character.

Instance

Example 1

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

The outputs are:

A
a

Example 2

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

The outputs are:

%
-

Example 2

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

The outputs are:

2
#