String, String$ Function
Language Items List
Definition:
Returns a string with the specified number of a given character. The character
can be specified with a given ANSI code or by a string whose first character
is the specified character.
Syntax (1):
String[$](number, charcode)
Syntax (2):
String[$](number, string)
Syntax Description
number Numeric expression indicating the length of the string to return. It must be
>= 0.
charcode ANSI code of the character to use in the return string. It is a numeric
expression that evaluates to an Integer between 0 and 255, inclusive.
string String expression whose first character is the character to use in the return
string.
Details:
String[$] returns a String.
Use String[$] to create a string that consists of one character used
repeatedly.
For syntax 2, the first character of the specified string is used to create
the return string as shown in the following example:
A$ = String$(5, "#$%") => “#####”
If the argument is any numeric type, as shown below, String[$] uses the
numeric value as the ANSI code that represents the character repeated in the return
String.
B$ = String$(5, 35)
Both of the previous examples return the same value, since 35 is the ASCII
code for the pound sign (#) character.
To convert numeric values greater than 255 to a valid ANSI code in the range
of 0 - 255, String [$] divides the value by 256 (argument Mod 256), then uses the remainder.
See Also:
ANSI character set
Space, Space$ Functions
Str, Str$ Functions