1
1
Fork 0
mirror of https://github.com/QB64Official/qb64.git synced 2024-07-20 19:45:15 +00:00
qb64/internal/help/RSET.txt
Luke Ceddia b586eafd3b Integrated _BLINEINPUT into regular LINE INPUT for BINARY files
LINE INPUT will now use the faster method if passed a file handle
that has been opened FOR BINARY. As such, the _BLINEINPUT command
has been removed.

qb64.bas now takes advantage of this for reading from '$include files,
at least in Include Manager 1. Some tweaking of internal/source/main.txt
was required to get things into a sane state, so I'm holing off changing
the compiler any further so the auto-builder can make sure everything's
smoothed over.

Note: Everything should still compile as normal; I'm just being overcautious.
2014-07-27 00:06:17 +10:00

43 lines
1.5 KiB
Plaintext

The '''RSET''' statement right-justifies a string according to length of the string expression.
{{PageSyntax}}
:: RSET string_variable = string_expression
* 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 ''string_expression'' is smaller than the fixed length, spaces will occupy the extra positions in the string.
* RSET can be used with a [[FIELD]] or [[TYPE]] string definition to set the buffer position before a [[PUT]].
''Example:''
{{CodeStart}} '' ''
{{Cl|CLS}}
{{Cl|DIM}} thestring {{Cl|AS}} {{Cl|STRING}} * 10
{{Cl|PRINT}} "12345678901234567890
{{Cl|RSET}} thestring = "Hello!"
{{Cl|PRINT}} thestring
anystring$ = {{Cl|SPACE$}}(20)
{{Cl|RSET}} anystring$ = "Hello again!"
{{Cl|PRINT}} anystring$
{{Cl|RSET}} thestring = "Over ten characters long"
{{Cl|PRINT}} thestring '' ''
{{CodeEnd}}
{{OutputStart}}
12345678901234567890
Hello!
Hello Again!
Over ten c
{{OutputEnd}}
:''Explanation:'' Notice how "Hello!" ends at the tenth position because the length of ''thestring'' is 10. When we used SPACE$(20) the length of ''anystring$'' became 20 so "Hello Again!" ended at the 20th position. That is right-justified. The last line "Over ten c" is truncated as it didn't fit into ''thestring'''s length of only 10 characters.
''See also:''
* [[RTRIM$]], [[FIELD]]
* [[LSET]], [[LTRIM$]]
* [[PUT]], [[GET]]
{{PageNavigation}}