IB Statements/string

From CometWiki

Jump to: navigation, search

STRING function

Syntax: STRING(string-argument, numeric-argument)

Discussion: The STRING function assembles a string of identical characters of specified length.

The character is determined by the string-argument, and the number of characters assembled is determined by the numeric-argument (or the defined length of the receiving string, whichever is smaller).

If the string-argument contains more than one character, only the first character is used to build a repeating string.

The string-argument may be a string constant, a single-element string variable, a string array element, a string expression, or a string function.

The numeric-argument may be a numeric constant, a single-element numeric variable, a numeric array element, a numeric expression, or a numeric function.

Note: If the numeric-argument has a value less than 1, the resulting string length will be zero. If the numeric-argument has a value greater than 254, the resulting string length will be 254 (the maximum length of any string in Internet Basic).

If the string-argument has a current length of zero, blanks (hex "@20@") will be used as the repeat character.

Example:  LENGTH 80 & LOCAL STARS$
.
.
.
STARS$ = STRING("*",80)

In the above example, the string variable STARS$ is assigned a value of 80 asterisks. It is assumed that STARS$ is defined with a length of at least 80. If STARS$ is defined with a smaller length, it will be filled completely with asterisks.

Personal tools