Chr

Description

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

Category

String functions

Syntax

Chr(number)  

Parameters

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

Usage

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

Example

<!--- 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>