RSET statement

Purpose

Right justify a string into the space of a string variable or User-Defined Type.

Syntax

RSET [ABS] result_var = string_expression [USING ustring_expression]

Remarks

RSET right-aligns a string within the space of another string, or within a variable of a User-Defined Type (UDT).

ABS

If ABS is specified, or ustring_expression is null (empty), RSET leaves the padding positions unchanged from their original content, rather than replacing them with spaces.

USING

If string_expression is shorter then result_var, RSET right-justifies string_expression within result_var, and pads remaining character positions on the left side using the first character in ustring_expression or spaces if not specified or is null (empty).

If string_expression is longer than result_var, RSET truncates string_expression from the right until it fits in result_var.

RSET can be used to assign the content of a User-Defined Type to a User-Defined Type variable of a different class, or assign a dynamic string to a User-Defined Type.  For example:

RSET MyUDT = STRING$(LEN(MyUDT), 0)

RSET MyUDT = b$

LSET works in a similar manner, but left-aligns string_expression; CSET performs center-justification.

See also

CSET, CSET$, GET, LET, LSET, LSET$, PUT, RESET, RSET$, STRINSERT$, TYPE SET

Example

a$ = SPACE$(20)

RSET a$ = "Right-align"

' result "         Right-align"

 

RSET a$ = "Right-align" USING "*"

' result "*********Right-align"