Siebel VB Language Reference > VB Language Reference >
This standard VB function right-aligns one string inside another string.
Rset string = string-expression
The string to receive the right-aligned characters
The string containing the characters to put into string
If string is longer than string-expression, the leftmost characters of string are replaced with spaces.
If string is shorter than string-expression, only the leftmost characters of string-expression are copied.
Rset cannot be used to assign variables of different user-defined types.
This example uses Rset to right-align an amount entered by the user in a field that is 15 characters long. It then pads the extra spaces with asterisks (*) and adds a dollar sign ($) and decimal places (if necessary).
Dim amount as String * 15
Dim x as Integer
Dim msgtext as String
Dim replacement as String
Dim position as Integer
replacement = "*"
amount = 234.56
position = InStr(amount,".")
If position = 0 then
amount = Rtrim(amount) & ".00"
Rset amount = "$" & Rtrim(amount)
length = 15-Len(Ltrim(amount))
For x = 1 to length
Mid(amount,x) = replacement