Siebel VB Language Reference > Siebel VB Language Reference >

String Function


This standard VB function returns a string consisting of a repeated character.

Syntax A

String[$](number, character)

Syntax B

String[$] (number, stringExpression)

Argument
Description
number
The length of the string to be returned
character
An integer or integer expression containing the ANSI code of the character to use
stringExpression
A string argument, the first character of which becomes the repeated character

Returns

A string containing number repetitions of the specified character.

Usage

Number must be between 0 and 32,767.

Character must evaluate to an integer between 0 and 255.

The dollar sign ($) in the function name is optional. If it is included, the return type is string. Otherwise the function returns a variant of vartype 8 (string).

Example

This example places asterisks (*) in front of a string that is printed as a payment amount.

Sub Button_Click
   Dim str1 as String
   Dim size as Integer
i: str1 = 666655.23
   If Instr(str1,".") = 0 then
      str1 = str1 + ".00"
   End If   
   If Len(str1)>10 then
      Goto i
   End If
   size = 10-Len(str1)
'Print amount in a space on a check allotted for 10 characters
   str1 = String(size,Asc("*")) & str1
End Sub

See Also

Space Function
Str Function


 Siebel VB Language Reference
 Published: 18 June 2003