Share via


CHR( ) Function

Returns the character associated with the specified numeric ANSI code.

CHR(nANSICode)

Return Value

Character

Parameters

  • nANSICode
    Specifies a number between 0 and 255 whose equivalent ANSI character CHR( ) returns.

    Use ASC( ) to return the ANSI value for a specified character.

Remarks

CHR( ) returns a single character corresponding to the numeric position of the character in the character table of the current code page. CHR( ) can be used to send printer control codes to a printer.

Example

The following example displays the numbers 65 through 75 and uses CHR( ) to display their corresponding character values A through K.

CLEAR
FOR nCOUNT = 65 TO 75
   ? nCount && Display numeric value 
   ?? ' ' + CHR(nCount) && Display character
ENDFOR

See Also

Reference

ASC( ) Function

INKEY( ) Function

SET ANSI Command

Other Resources

Functions

Language Reference (Visual FoxPro)