Export (0) Print
Expand All

Strings.StrDup Method (Int32, Object)

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)

public static Object StrDup (
	int Number,
	Object Character
)
public static Object StrDup (
	int Number, 
	Object Character
)
public static function StrDup (
	Number : int, 
	Character : Object
) : Object
Not applicable.

Parameters

Number

Required. Integer expression. The length to the string to be returned.

Character

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

Returns a string or object consisting of the specified character repeated the specified number of times.

For more detailed information, see the Visual Basic topic StrDup Function.

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.

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

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0, 1.1, 1.0

.NET Compact Framework

Supported in: 2.0, 1.0

Community Additions

ADD
Show:
© 2014 Microsoft