[next] [previous] [contents]

  12.5.3 RSET Statement
  The RSET statement right-justifies data and assigns it to a
  string variable without changing the variable's length. In the
  following example, C_R is a string variable and ``cust_rec'' is
  a string constant:
  RSET C_R = "cust_rec"

  RSET right-justifies a string expression shorter than the
  string variable and pads it with spaces on the left. In the fol-
  lowing example, the LET statement creates the 5-character
  string variable test$ . The RSET statement in the second line
  assigns the string XYZ to test$ but does not change the length
  of test$ . Because test$ is five characters long, the RSET
  statement pads XYZ with two spaces when assigning the
  value. The PRINT statement shows that test$ includes these
  two spaces.
  LET test$ = "ABCDE"
  RSET test$ = "XYZ"
  PRINT "'" ; test$; "'"
  END

  Output
  ' XYZ'
  If the string expression's value is longer than the string vari-
  able, RSET right-justifies the string expression and truncates
  characters on the left to fit the string variable as shown in
  the following example:
  LET test$ = "ABCDE"
  RSET test$ = "987654321"
  PRINT test$
  END

  Output
  54321
  The LET statement creates a 5-character string variable,
  test$
. The RSET statement assigns ``54321'' to test$ . RSET,
  which does not change the variable's length, truncates ``9876''
  from the left side of the string expression.

  Note that, when using LSET and RSET, padding can become
  part of the data.
  LET A$ = '12345'
  LSET A$ = 'ABC'
  LET B$ = '12345678'
  RSET B$ = A$
  PRINT "'";B$;"'"

  Output
  ' ABC '