Chr[$] Function
Language Items List
Definition:
Returns a one-character string that corresponds to the ANSI code supplied in
the argument.
Syntax:
Chr[$](charcode)
Syntax Description
charcode An integer between 0 and 255, inclusive.
Details:
Chr returns a one-character string. The ‘$’ is optional on all string functions, and has no effect. This function is
useful for specifying the nonprintable ASCII codes in the range 0 to 31, such as
special printer control codes that are used in all Windows applications. For
example, Chr(10) can be used to generate a newline when formatting message strings
for output.
Similiarly Chr(34) can be used to produce a double quote character. Using Chr
is only one way to form strings with embedded special characters. Some
shortcuts for forming strings are as follows:
To insert special characters in a string, use the ^ notation rather than the
Chr function. This method is more efficient than using Chr because it does not
involve string concatenation.
To generate control codes that correspond to Chr(1) through Chr(26) (e.g. “^J” = Chr(10)) use the ^ character (Shift 6) followed by an alphabetic character
To make a string with an embedded newline, use Ex: “hello^Jworld” . This is equivalent to forming the string with “hello” & Chr(10) & “world”.
To include a ^ in a string precede the "^" with a "^." The program then
ignores the control-code meaning of ^ and prints the “^."
To include a double-quote in a string, precede a double-quote with another
double quote. The program then ignores the control code meaning of the
double-quote allowing you to print the double-quote. (e.g. “ “”quote””ed string”)
See Also:
ANSI character set
Asc Function
Str, Str$