The STR function repeats the given expression a specified number of times.
Format
STR(string,expr) |
Parameter(s)
string |
String expression to be repeated in the generated string. |
expr |
An expression specifying the number of times string is to be repeated in the result. If expr does not evaluate to an integer, it is truncated (For example, if expr were “5.5” it would be truncated to “5”.). If expr evaluates to a value less than 1, no value is returned. If expr evaluates to a value greater than “16777215”, string is truncated to 16777215 bytes. |
Description
The STR function produces a specified number of repetitions of a particular character string.
Example
To print ten asterisks on the screen, the code might read:
PRINT STR( " * ", 10) |
In the next application, a table is printed listing an initial mortgage, interest rate, amount of payments, and the number of years and months it will take to pay off the mortgage at that rate. The STR function produces a line across an 80-column screen between the heading and the data.
PRINT "MORGAGE","RATE","PAYMENTS","YEARS","MONTHS" PRINT STR("_",80) PRINT ORIG.MORG "L,$",ORIG.RATE,PAYMENT "L2,$",YEARS,MONTH |
See Also