RSet Statement

Aliña á dereita unha cadea dentro dunha variábel de cadea ou copia unha variábel de tipo definido polo usuario noutra.

Sintaxe:

RSet Texto As String = Texto or RSet Variable1 = Variable2

Parámetros:

Text: Any string variable.

Text: String that you want to right-align in the string variable.

Variable1: User-defined variable that is the target for the copied variable.

Variable2: User-defined variable that you want to copy to another variable.

If the string is shorter than the string variable, RSet aligns the string to the right within the string variable. Any remaining characters in the string variable are replaced with spaces. If the string is longer than the string variable, characters exceeding the length of the variable are truncated, and only the remaining characters are right-aligned within the string variable.

You can also use the RSet statement to assign variables of one user-defined type to another.

The following example uses the RSet and LSet statements to modify the left and right alignment of a string.

Exemplo:

Sub ExampleRLSet

Dim sVar As String

Dim sExpr As String

    sVar = String(40,"*")

    sExpr = "SBX"

    REM Aliña "SBX" á dereita nunha cadea 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ña "SBX" á esquerda nunha cadea de 40 caracteres

    LSet sVar = sExpr

    Print ">"; sVar; "<"

    sVar = String(5,"*")

    sExpr = "123456789"

    LSet sVar = sExpr

    Print ">"; sVar; "<"

End Sub