#nn and Chr() Function

Purpose

Return either a single or a string of character from the extended ASCII table.

Syntax

$ = #m#$h#on

$ = Chr[$](m [,$h [,&on [,%b…]]])

m : Decimal integer
$h : hexadecimal integer
on, &on: Octal integer
%b: Binary integer

Description

Both these structures return a single character or a character string, determined by the arguments passed. The Pascal-type # can take values in decimal, hexadecimal and octal, while the more traditional basic Chr() function can accept all those plus binary.

Example

Global a$ = "Text 1" #13#10 "Text 2" #13#10

a$ = a$ & #50#$32#o62

Print a$

is equivalent to:

Global a$ = "Text 1" & Chr(13) & Chr(10) & "Text 2" & Chr(13, 10)

a$ = a$ & Chr(50, $32, &o62)

Print a$

Remarks

Print #123 causes an error as the program confuses the # for a stream number and gives an error. However Print #123#125 does work.

The # (hash) character has many other uses as well. It is used with formatting strings, file channels (see Open), and Date literals (#23.07.2000#).

See Also

Asc(), Mk1$(), Mki$(),Mkl$(), Mks$(), Mkd$()

{Created by Sjouke Hamstra; Last updated: 02/10/2017 by James Gaite}