RSet (statement)

Syntax

RSet destvariable = source

Description

Copies the source string source into the destination string destvariable.

Comments

If source is shorter in length than destvariable, then the string is right-aligned within destvariable and the remaining characters are padded with spaces. If source is longer in length than destvariable, then source is truncated, copying only the leftmost number of characters that will fit in destvariable. A runtime error is generated if source is Null.

The destvariable parameter specifies a String or Variant variable. If destvariable is a Variant containing Empty, then no characters are copied. If destvariable is not convertible to a String, then a runtime error occurs. A runtime error results if destvariable is Null.

Example

This example replaces a 40-character string of asterisks (*) with an RSet and LSet string and then displays the result.

Const crlf = Chr$(13) + Chr$(10)

Sub Main()
  Dim msg1,tmpstr$
  tmpstr$ = String(40,"*")
  msg1 = "Here are two strings that have been right-" + crlf
  msg1 = msg1 & "and left-justified in a 40-character string."
  msg1 = msg1 & crlf & crlf
  RSet tmpstr$ = "Right|"
  msg1 = msg1 & tmpstr$ & crlf
  LSet tmpstr$ = "|Left"
  msg1 = msg1 & tmpstr$ & crlf
  MsgBox msg1
End Sub

See Also

LSet (statement).

More information

R