Get Repeated Character String Method
The Get Repeated Character String method creates a string that consists of a repeated character. It returns this string.
Format A
String[$](number, character)
String[$] (number, stringExpression)
For information about the dollar sign, see Usage of the Dollar Sign.
Arguments
The following table describes the arguments that you can use with this method.
Argument | Description |
---|---|
number |
The length of the string that this method returns. This number must reside in the range of 0 through 32,767. |
character |
An integer or integer expression that contains the ANSI code of the character that this method uses. This argument must evaluate to an integer in the range of 0 through 255. |
stringExpression |
A string argument. This method uses the first character of this argument as the repeated character. |
Example
The following example places asterisks (*) in front of a string that it prints 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