Chr

Description

ASCII Character function.

Return value

A character, of the given ASCII character code.

Category

String functions

Syntax

Chr(number)  

See also

Asc

History

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

Parameters

Parameter Description
number
A value (a number in the range 0 to 255, inclusive)

Usage

The values 0 - 31 are standard, nonprintable codes. For example:

Example

<h3>CHR Example</h3>
<!--- if the character string is not empty, output its CHR value --->
<cfif IsDefined("FORM.Submit")>
  <cfoutput>#FORM.charVals# = #CHR(FORM.charVals)#</cfoutput>
</cfif>
<form action = "chr.cfm">
<p>Enter a number between 1 and 256 to see the ASCII representation.
<input type = "hidden" name = "CharVals_range" Value = "Min = 1 Max = 256">
<input type = "hidden" name = "CharVals_required" Value = "Enter an integer from 1
to 256">
<br><input type = "Text" name = "CharVals">
<p><input type = "Submit" name = "Submit"> <input type = "RESET">
</form>

Comments