Strings.StrDup Method (Int32, Char)
Microsoft Silverlight will reach end of support after October 2021. Learn more.
Returns a string or object consisting of the specified character repeated the specified number of times.
Namespace: Microsoft.VisualBasic
Assembly: Microsoft.VisualBasic (in Microsoft.VisualBasic.dll)
Syntax
'Declaration
Public Shared Function StrDup ( _
Number As Integer, _
Character As Char _
) As String
public static string StrDup(
int Number,
char Character
)
Parameters
- Number
Type: System.Int32
Required. Integer expression. The length to the string to be returned.
- Character
Type: System.Char
Required. Any valid Char, String, or Object expression. Only the first character of the expression will be used. If Character is of type Object, it must contain either a Char or a String value.
Return Value
Type: System.String
Returns a string or object consisting of the specified character repeated the specified number of times.
Remarks
This function returns a String made up of repeated characters. The character that makes up the string is the first character in the Character argument, and it is duplicated Number number of times.
Examples
This example uses the StrDup function to return a string of duplicated characters.
Dim aString As String = "Wow! What a string!"
Dim aObject As New Object
Dim TestString As String
aObject = "This is a String contained within an Object"
' Returns "PPPPP"
TestString = StrDup(5, "P")
' Returns "WWWWWWWWWW"
TestString = StrDup(10, aString)
' Returns "TTTTTT"
TestString = CStr(StrDup(6, aObject))
Version Information
Silverlight
Supported in: 5, 4, 3
Platforms
For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.