Chr

Returns a character of a given ASCII value (character code).

See also Asc.

Syntax

Chr(number) 
number

Any ASCII value (a number in the range 0 to 255 inclusive).

Usage

Numbers from 0 to 31 are the standard, nonprintable ASCII codes. For example, Chr(10) returns a linefeed character and Chr(13) returns a carriage return character. Therefore, the two-character string Chr(13) & Chr(10) is the newline string.

Examples

<!--- This code illustrates CHR --->
<HTML>
<HEAD>
<TITLE>
CHR Example
</TITLE>
</HEAD>

<BODY BGCOLOR=silver>
<H3>CHR Example</H3>
<!--- if the character string is not empty, then
output its CHR value --->
<CFIF IsDefined("FORM.Submit")>
        <CFOUTPUT>#FORM.charVals# = #CHR(FORM.charVals)#</CFOUTPUT>
</CFIF>

<FORM ACTION="chr.cfm" METHOD="POST">
<P>Type in a number between 1 and 256 to see the ASCII character 
representation.
<INPUT TYPE="hidden" NAME="CharVals_range" Value="Min=1 Max=256">
<INPUT TYPE="hidden" NAME="CharVals_required" Value="Please enter an 
integer from 1 to 256">

<BR><INPUT TYPE="Text"
      NAME="CharVals">
<P><INPUT TYPE="Submit" NAME="Submit"> <INPUT TYPE="RESET">
</FORM>

</BODY>
</HTML> 

1