A character, of the given ASCII character code.
Chr(number)
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.)
Parameter | Description |
---|---|
number |
A value (a number in the range 0 to 255, inclusive) |
The values 0 - 31 are standard, nonprintable codes. For example:
Chr(10)
returns a linefeed character
Chr(13)
returns a carriage return characterChr(13) & Chr(10)
returns a newline <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>