Siebel VB Language Reference > VB Language Reference >

Rset Statement

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


Not applicable


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).

Sub Button_Click

   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"
   End If
   Rset amount = "$" & Rtrim(amount)
   length = 15-Len(Ltrim(amount))
   For x = 1 to length
      Mid(amount,x) = replacement
      Next x
End Sub

See Also

Lset Statement

Siebel VB Language Reference