Convert an ASCII code to a character value.
XSharp.Core (in XSharp.Core.dll) Version: 2.4a
Syntax View Source
dwCode AS DWORD
) AS STRING
public static string Chr(
- Type: UInt32
An ASCII code from 0 to 255.
A single character that corresponds to <dwCode>.
Chr() is the inverse of Asc(). Chr() serves a number of common tasks including:
Sending control codes and graphics characters to the screen or printer
Ringing the bell
Converting InKey() return values to characters
Stuffing the keyboard buffer
Chr(0) has a length of 1 and is treated like any other character; this lets you send it to any device or file, including a database file.
_Chr() is an operator that does the same thing as the Chr() function.|
As an operator, it is evaluated at compile time and can be used in DEFINE, GLOBAL, or STATIC LOCAL statements to specify initial values. Because it does not incur the overhead of a function call, it is more efficient. Here is an example:
1DEFINE CRLF := _Chr(ASC_CR) + _Chr(ASC_LF)
The value of dwChar must be between 0 and 255
The return value of Chr() in XSharp depends on the setting of SetAnsi().
When SetAnsi() = TRUE then the active windows Ansi codepage is used to calculate the character.
When SetAnsi() = FALSE then the active windows Oem codepage is used to calculate the character.
This is different from the behior in most single byte versions of Xbase where Chr() simply returnes a string with a single byte
that matches the number passed to this function.
These examples illustrate Chr() with various arguments:
1? Chr(Asc("A") + 32)