LSet Statement

Description

Left aligns a string within a string variable, or copies a variable of one user-defined type to another variable of a different user-defined type.

Syntax

LSet stringvar = stringLSet varname1 = varname2

The LSet statement syntax has these parts:

Part

Description

stringvar

Name of string variable.

string

String expression to be left-aligned within stringvar.

varname1

Variable name of the user-defined type being copied to.

varname2

Variable name of the user-defined type being copied from.


Remarks

LSet replaces any leftover characters in stringvar with spaces.

If string is longer than stringvar, LSet places only the leftmost characters, up to the length of the stringvar, in stringvar.

Warning Using LSet to copy a variable of one user-defined type into a variable of a different user-defined type is not recommended and should not be done without understanding that copying data of one data type into space reserved for a different data type can cause unpredictable results.

When you copy a variable from one user-defined type to another, the binary data from one variable is simply copied into the memory space of the other, without regard for the data types specified for the elements contained within.

See Also

RSet Statement.

Example

This example uses the LSet statement to left align a string within a string variable. Although LSet can also be used to copy a variable of one user-defined type to another variable of a different, but compatible, user-defined type, this practice is not recommended. Due to the varying implementations of data structures among platforms, such a use of LSet cannot be guaranteed to be portable.


MyString = "0123456789"    ' Initialize string.MyString = "<-Left"    ' MyString contains "<-Left    ".