Asc

Description

Determines the ASCII value of a character.

Returns

The ASCII value of the first character of a string; if the string is empty, returns zero.

Category

String functions

Function syntax

Asc(string)

See also

Chr

History

ColdFusion MX: Changed Unicode support: ColdFusion supports the Java UCS-2 representation of Unicode characters, up to a value of 65536. (Earlier releases supported 1-255.)

Parameters

Parameter

Description

string

A string, an empty string, or a number.

Example

<cfscript>
       WriteOutput(Asc("") & "|"); //returns 0 since ASCII value of empty string is 0
       WriteOutput(Asc("a") & "|"); //returns 97 since ASCII value of "a" is 97
       WriteOutput(Asc("A") & "|"); //returns 65 since ASCIII value of "A" is 65
       WriteOutput(Asc("null") & "|"); //returns 110 since ASCII value of "n" is 110
       WriteOutput(Asc("Null")); //returns 78 since ASCII value of "N" is 78
</cfscript>

Output

0|97|65|110|78

 Adobe

Get help faster and easier

New user?