LSET
This page was last modified 15:05, 8 November 2021 by Mars2000you. Based on work by NYYRIKKI.

Contents

Effect

Assigns a value to an existing string variable while keeping the original string length.

If the new string is longer than the old string, extra characters at end of string will be ignored.

If the new string is shorter than the old string, then the end of string will be padded with spaces.

Notes :

  • If you have specified a place inside record with the FIELD instruction, RSET will store the variable value to record buffer.
  • LET can't be used to modify the record buffer, because it moves variable back to normal variable storage space. When handling random access files, you need to use LSET or RSET instead of LET.

Syntax

LSET <Variable> = <Value>

Parameters

<Variable> is an existing string variable, whose content length will not change.

<Value> is a string or string expression. String expression can not contain the original <variable> as parameter. (ie. LSET D$=D$ will not work)

Example

LET A$=SPACE$(5) : LSET A$="ABCDEF" : PRINT A$
ABC
Ok

Related To

FIELD, LET, RSET, VARPTR

Compatibility

Disk BASIC 1.0 or higher / both modes of Nextor OS