MapInfo Corporation PreviousNext

 


Chr$( ) function

Purpose

Returns a one-character string corresponding to a specified character code.

Syntax

Chr$( num_expr ) 

num_expr is an integer value from 0 to 255 (or, if a double-byte character set is in use, from 0 to 65,535), inclusive.

Return Value

String

Description

The Chr$( ) function returns a string, one character long, based on the character code specified in the num_expr parameter. On most systems, num_expr should be a positive integer value between 0 and 255. On systems that support double-byte character sets (e.g., Windows Japanese), num_expr can have a value from 0 to 65,535.

Note: All MapInfo Professional environments have common character codes within the range of 32 (space) to 126 (tilde).

If the num_expr parameter is fractional, MapBasic rounds to the nearest integer.

Character 12 is the form-feed character. Thus, you can use the statement Print Chr$(12) to clear the Message window. Character 10 is the line-feed character; see example below.

Character 34 is the double-quotation mark ("). If a string expression includes the function call Chr$(34), MapBasic embeds a double-quote character in the string.

Error Conditions

The ERR_FCN_ARG_RANGE error is generated if an argument is outside of the valid range.

Example

Dim s_letter As String * 1
s_letter = Chr$(65)
Note s_letter ' This displays the letter "A"
Note "This message spans" + Chr$(10) + "two lines."

See Also

Asc( ) function


© 2007 MapInfo Corporation. All rights reserved.
Email: docs@mapinfo.com
PreviousNext