Contido

# Instrución LSet

Aliña unha cadea á esquerda dunha variábel, ou copia unha variábel dun tipo definido polo usuario noutra doutro tipo definido polo usuario.

### Sintaxe:

    LSet Var As String = Texto or LSet Var1 = Var2

### Parámetros:

Var: Any String variable that contains the string that you want align to the left.

Text: String that you want to align to the left of the string variable.

Var1: Name of the user-defined type variable that you want to copy to.

Var2: Name of the user-defined type variable that you want to copy from.

If the string is shorter than the string variable, LSet left-aligns the string within the string variable. Any remaining positions in the string variable are replaced by spaces. If the string is longer than the string variable, only the leftmost characters up to the length of the string variable are copied. With the LSet statement, you can also copy a user-defined type variable to another variable of the same type.

### Exemplo:

    Sub ExampleRLSet
    Dim sVar As String
    Dim sExpr As String
        sVar = String(40,"*")
        sExpr = "SBX"
        REM Aliña "SBX" na cadea de referencia de 40 caracteres
        REM Reempraza asteriscos con espazos
        RSet sVar = sExpr
        Print ">"; sVar; "<"
        sVar = String(5,"*")
        sExpr = "123457896"
        RSet sVar = sExpr
        Print ">"; sVar; "<"
        sVar = String(40,"*")
        sExpr = "SBX"
        REM Aliñar "SBX" á esquerda dentro da cadea de referencia de 40 caracteres
        LSet sVar = sExpr
        Print ">"; sVar; "<"
        sVar = String(5,"*")
        sExpr = "123456789"
        LSet sVar = sExpr
        Print ">"; sVar; "<"
    End Sub

Temas relacionados

String functions