QB64.com

QB64 is a modern extended BASIC programming language that retains QBasic/QuickBASIC 4.5 compatibility and compiles native binaries for Windows, Linux, and macOS.

The RSET statement right-justifies a string according to length of the string expression.

Syntax

RSET string_variable = string_expression

Example(s)


CLS
DIM thestring AS STRING * 10
PRINT "12345678901234567890"
RSET thestring = "Hello!"
PRINT thestring
anystring$ = SPACE$(20)
RSET anystring$ = "Hello again!"
PRINT anystring$
RSET thestring = "Over ten characters long"
PRINT thestring 


12345678901234567890
    Hello!
        Hello Again!
Over ten c

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