Siebel VB Language Reference > Methods Reference for Siebel VB > String Methods >

Right-Justify String Method


The Right-Justify String method right-justifies one string in another string. It does not return a value. It justifies a string in the following ways:

  • Value in the string argument is longer than string-expression. It replaces the leftmost characters of the string with spaces.
  • Value in the string argument is shorter than string-expression. It copies only the leftmost characters of string-expression.

You cannot use it to assign variables of different custom types.

Format

Rset string = string-expression

The following table describes the arguments that you can use with this method.

Argument
Description

string

The string that receives the right-aligned characters.

string-expression

The string that this method puts into the string that the string argument contains.

Example

The following example right-justifies an amount that the user enters 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

Siebel VB Language Reference Copyright © 2013, Oracle and/or its affiliates. All rights reserved. Legal Notices.