mirror of
https://github.com/QB64Official/qb64.git
synced 2024-09-28 11:17:47 +00:00
f1a0146579
Removes references to qb64 dot net.
50 lines
1.8 KiB
Text
50 lines
1.8 KiB
Text
The {{KW|STRING$}} function returns a {{KW|STRING}} consisting of a single character repeated a number of times.
|
|
|
|
|
|
{{PageSyntax}}
|
|
: result$ = STRING$(''count&'', {''character$'' | ''ASCIIcode%''} )
|
|
|
|
|
|
{{PageDescription}}
|
|
<!-- Stylin -->
|
|
* {{Parameter|count&}} is the number of times the character specified by {{Parameter|character}} is repeated.
|
|
* Character is a literal string character, a string variable or an [[ASCII]] code number.
|
|
* If {{Parameter|count&}} is negative, an [[ERROR Codes|illegal function call]] error will occur. The count can be zero.
|
|
* If {{Parameter|character}} is a [[STRING]] value and its length is zero, an [[ERROR Codes|illegal function call]] error will occur.
|
|
* If more than one string character value is used, the first character will be repeated.
|
|
* A [[STRING]] statement can be added to a string value with the + [[concatenation]] operator.
|
|
* The function result can also be used to [[GET]] and [[PUT]] a number of bytes as zero characters: bytes$ = STRING(numbytes, 0)
|
|
|
|
|
|
''Differences between QB64 and QB 4.5:''
|
|
* '''QB64''' can use [[LONG]] values for a count up to 2,147,483,647 while '''QB 4.5''' could only use [[INTEGER]] values up to 32,767.
|
|
|
|
|
|
{{PageExamples}}
|
|
:Printing 40 asterisks across the screen using an ASCII character code instead of [[CHR$]](42).
|
|
{{CodeStart}}{{Cl|PRINT}} {{Cl|STRING$}}(40, 42)
|
|
{{CodeEnd}}
|
|
{{OutputStart}}****************************************
|
|
{{OutputEnd}}
|
|
|
|
|
|
:Using a [[STRING]] to specify the repeated character.
|
|
{{CodeStart}}text$ = "B" + {{Cl|STRING$}}(40, "A") + "D"
|
|
{{Cl|PRINT}} text$
|
|
{{CodeEnd}}
|
|
{{OutputStart}}BAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD
|
|
{{OutputEnd}}
|
|
|
|
|
|
''See examples:''
|
|
* [[SAVEIMAGE]]
|
|
* [[SaveIcon32]]
|
|
|
|
|
|
{{PageSeeAlso}}
|
|
* [[SPACE$]]
|
|
* [[ASC]], [[CHR$]]
|
|
* [[ASCII]]
|
|
|
|
|
|
{{PageNavigation}}
|