1
1
Fork 0
mirror of https://github.com/QB64-Phoenix-Edition/QB64pe.git synced 2024-07-26 16:45:53 +00:00
QB64-PE/internal/help/STRING$.txt
SMcNeill 6e01fc8dce Altered string compare routines (<,<=,>,>=) so they don't give false results with CHR$(0).
Added new _STRCMP and _STRICMP commands for quick string comparisons.
Cleaned up QB64 to finish removing the QUI (quick user insert) code and folders.
Altered UCASE and LCASE routines to be faster in some situations for us.
2014-09-22 08:19:03 -04:00

47 lines
1.7 KiB
Plaintext

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}}
&lt;!-- Stylin --&gt;
* {{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)
{{PageExamples}}
:Printing 40 asterisks across the screen using an ASCII character value.
{{CodeStart}}{{Cl|PRINT}} {{Cl|STRING$}}(40, 42)
{{CodeEnd}}
{{OutputStart}}****************************************
{{OutputEnd}}
:Using a {{KW|STRING}} to specify the repeated character.
{{CodeStart}}text$ = &quot;B&quot; + {{Cl|STRING$}}(40, &quot;A&quot;) + &quot;D&quot;
{{Cl|PRINT}} text$
{{CodeEnd}}
{{OutputStart}}BAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD
{{OutputEnd}}
''Note:'' The string contatenation + operator MUST be used in [[STRING]] variable definitions.
''See examples:''
* [[SAVEIMAGE]]
* [[SaveIcon32]]
{{PageSeeAlso}}
* [[SPACE$]]
* [[ASC]], [[CHR$]]
* [[ASCII]]
{{PageNavigation}}