|
A string function that returns a string whose characters all have a given
ASCII code or whose characters are all the first character of a string expression.
Syntax: STRING$(count, byte)
A$ = STRING$(9, 65) '-- Returns AAAAAAAAA
Syntax: STRING$(count, string-expression)
A$ = STRING$(9, "ABC") '-- Returns AAAAAAAAA
Details:
The first parameter indicates the number of times to repeat the character.
The second parameter can either be a string expression, whose first character is
used as the repeat character, or a byte number in the range from 0 to 255 representing the
ASCII character code.
Note:
RapidQ limits STRING$ to a 2K buffer and there's no error checking
for overflow. For large strings use the SnakeDile fixed
LIBs dated
November, 2006 or later, which is also a lot faster, f you can't
get the fixed libs, you can also
patch it with this code.
FUNCTIONI gRQ2_STRINGex$(...) AS
STRING 'FunctionI to accept byte or Char
DEFLNG Count = ParamVal(1)
IF Count > 0 THEN
DEFBYTE InChar
IF ParamStrCount THEN
InChar
= ASC(ParamStr$(1))
ELSE
InChar
= ParamVal(2) AND &HFF
END IF
DIM tmpStr AS STRING *
Count
MEMSET(Varptr(tmpStr),
InChar, Count)
RESULT = tmpStr
ELSE
RESULT = ""
END IF
END FUNCTIONI
$UNDEF STRING$
$DEFINE STRING$ gRQ2_STRINGex$
|
|
|
|