STRING$/STRING$$ function  

Purpose

Return a string consisting of multiple copies of the specified character.

Syntax

s$  = STRING$(Count&, Character%)

s$  = STRING$(Count&, Character$)

s$$ = STRING$$(Count&, Character%)

s$$ = STRING$$(Count&, Character$$)

Remarks

This function creates a string which consists of multiple copies of a particular character.  The STRING$() form creates a string of ANSI (1-byte) characters, or codes in the range of 0 to 255.  The STRING$$() form of the function creates a string of WIDE (2-byte) characters, or codes in the range of 0 to 65535.

Generally speaking, PowerBASIC handles ANSI/WIDE conversions for you, automatically and transparently.  However, there are just a few functions (CHR$, PEEK$, POKE$, STRING$, etc) which are ambiguous, by definition, and require that the programmer choose the appropriate result type (ANSI or WIDE).  Use STRING$ for ANSI results, or use STRING$$ for Unicode results.  In the remainder of these remarks, STRING$ is used to represent both STRING$ and STRING$$.

STRING$ with a numeric argument returns a string of Count& copies of the character with the Character Code of Character%.  STRING$ with a string argument returns a string of Count& copies of the first character in Character$ or Character$$.

The following functions all return a string of 8 spaces:

A$ = STRING$(8, 32)

A$ = STRING$(8, " ")

A$ = STRING$(8, $SPC)

A$ = SPACE$(8)

A$ = REPEAT$(8, " ")

A$ = REPEAT$(8, $SPC)

Use REPEAT$ to make multiple copies of a multiple-character string, and SPACE$ to return a string of space characters.

See also

ASC, BUILD$, CHR$, NUL$, REPEAT$, SPACE$