VBScript Asc Function

Definition and Usage

The Asc function can convert the first letter of a string to the corresponding ANSI code and return the result.

Syntax

Asc(string)
Parameter Description
string Required. String expression. Cannot be an empty string!

Instances

Example 1

document.write(Asc("A"))
document.write(Asc("F"))

The outputs are:

65
70

Example 2

document.write(Asc("a"))
document.write(Asc("f"))

The outputs are:

97
102

Example 3

document.write(Asc("W"))
document.write(Asc("codew3c.com"))

The outputs are:

87
87

Example 4

document.write(Asc("2"))
document.write(Asc("#"))

The outputs are:

50
35