Determines the value of a character.
The value of the first character of a string; if the string is empty, returns zero.
Asc(string)
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.)
|
Parameter |
Description |
|---|---|
| string |
A string |
<h3>Asc Example</h3>
<!--- If the character string is not empty, output its ASCII value. --->
<cfif IsDefined("FORM.charVals")>
<cfif FORM.charVals is not "">
<cfoutput>#Left(FORM.charVals,1)# =
#Asc(FORM.charVals)#</cfoutput>
<cfelse>
<!--- If it is empty, output an error message. --->
<h4>Enter a character</h4>
</cfif>
</cfif>
<form action = "asc.cfm" method=post>
<p>Enter a character to see its ASCII value
<br><input type = "Text" name = "CharVals" size = "1" maxlength = "1"></p>
<p><input type = "Submit" name = ""> <input type = "RESET"></p>
</form>