RSet Statement

Syntax

RSet stringvar = string

stringvar

Use: Required

Data Type: String

The name of a string variable to receive string.

string

Use: Required

Data Type: String

A string expression to be copied into stringvar.

Description

Copies string into stringvar, right-aligning string within stringvar.

Rules at a Glance

  • RSet has meaning only when dealing within fixed-length strings.

  • If the length of string is less than that of stringvar, the extra characters within stringvar are padded with spaces.

  • If the length of string is greater than that of stringvar, string is truncated to the length of stringvar.

Programming Tips and Gotchas

  • RSet can't be used with user-defined types.

  • RSet overwrites the entire contents of stringvar. The last len(string) characters are overwritten by the value of string, while the remaining characters are replaced with spaces.

See Also

LSet Statement

Get VB & VBA in a Nutshell: The Language now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.