Skip to content

BASIC STRING Function

Mike Hogsett edited this page Aug 5, 2024 · 2 revisions

STRING$

TYPE: plusBASIC string function

FORMAT: STRING$ ( length )

Action: Returns a string of composed of length spaces (ASCII code 32).

  • _length _ is an expression that evaluates to an integer.
  • Illegal Quantity Error results if length is not in the range 0 through 255.

Example:

PRINT "<";STRING$(20);">"

Prints < >


FORMAT: STRING$ ( length , byte ) Action: As above, but the string is composed of the characters with ASCII code byte.

  • _byte _ is an expression that evaluates to an integer.
  • Illegal Quantity Error results if byte is not in the range 0 through 255.

Example:

PRINT STRING$(5,64)

Prints @@@@@

PRINT STRING$(3,'Z')

Prints ZZZ


FORMAT: STRING$ ( length , string )

Action: As above, but the string is composed of the first character of string.

  • Illegal Quantity Error results if string is empty.

Example:

  10 X$=STRING$(10,"-")
  20 PRINT X$;"MONTHLY REPORT";X$

Prints ----------MONTHLY REPORT----------

Clone this wiki locally