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.

LSET left-justifies a fixed length string expression based on the size of the STRING variable and string expression.

Syntax

LSET {stringVariable = stringExpression stringExpression1 = stringExpression2}

Description

Example(s)

Using LSET with a FIELD definition. Note: May create an empty (unchanged) file that can be deleted.


OPEN "testfile.dat" FOR RANDOM AS #1 LEN = 15
FIELD 1, 6 AS a$, 9 AS other$
FIELD 1, 2 AS b$, 13 AS another$
LSET a$ = "1234567890"
LSET other$ = "1234567890"
PRINT a$, b$, other$, another$
CLOSE #1



123456            12         123456789     3456123456789 

How LSET can define two different string length values in one statement.


TYPE ninestring
head AS STRING * 9
END TYPE

TYPE fivestring
head AS STRING * 5
END TYPE

DIM me AS ninestring, you AS fivestring
me.head = "ACHES NOT"
CLS

LSET you.head = me.head
PRINT "me.head: "; me.head
PRINT "you.head: "; you.head


me.head: ACHES NOT
you.head: ACHES

See Also