1
1
Fork 0
mirror of https://github.com/QB64-Phoenix-Edition/QB64pe.git synced 2024-07-26 17:55:52 +00:00
QB64-PE/internal/help/LSET.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

63 lines
1.7 KiB
Plaintext

'''LSET''' left-justifies a fixed length string expression based on the size of the [[STRING]] variable and string expression.
{{PageSyntax}}
: LSET {string_variable = string_expression | string_expression1 = string_expression2}
* If the string expression is longer than a fixed length string variable the value is truncated from the right side in LSET or [[RSET]].
* If the LSET string expression is smaller, spaces will occupy the extra positions to the right in the string.
* LSET can be used with a [[FIELD]] or [[TYPE]] definition to set the buffer position before a [[PUT]].
''Example 1:'' Using LSET with a [[FIELD]] definition. Note: May create an empty(unchanged) file that can be deleted.
{{CodeStart}}
'' ''
{{Cl|OPEN}} &quot;testfile.dat&quot; FOR {{Cl|RANDOM}} AS #1 {{Cl|LEN}} = 15
{{Cl|FIELD}} 1, 6 {{Cl|AS}} a$, 9 {{Cl|AS}} other$
{{Cl|FIELD}} 1, 2 {{Cl|AS}} b$, 13 {{Cl|AS}} another$
{{Cl|LSET}} a$ = &quot;1234567890&quot;
{{Cl|LSET}} other$ = &quot;1234567890&quot;
{{Cl|PRINT}} a$, b$, other$, another$
{{Cl|CLOSE}} #1
{{CodeEnd}}
{{OutputStart}}
123456 12 123456789 3456123456789
{{OutputEnd}}
''Example 2:'' How LSET can define two different string length values in one statement.
{{CodeStart}}
{{Cl|TYPE}} ninestring
head {{Cl|AS}} {{Cl|STRING}} * 9
{{Cl|END TYPE}}
{{Cl|TYPE}} fivestring
head AS {{Cl|STRING}} * 5
{{Cl|END TYPE}}
{{Cl|DIM}} me {{Cl|AS}} ninestring, you {{Cl|AS}} fivestring
me.head = &quot;ACHES NOT&quot;
{{Cl|CLS}}
{{Cl|LSET}} you.head = me.head
{{Cl|PRINT}} &quot;me.head: &quot;; me.head
{{Cl|PRINT}} &quot;you.head: &quot;; you.head
{{CodeEnd}}
{{OutputStart}}
me.head: ACHES NOT
you.head: ACHES
{{OutputEnd}}
''See also:''
* [[RSET]], [[RTRIM$]]
* [[FIELD]], [[TYPE]]
{{PageNavigation}}