Name

StrDup Function

Class

Microsoft.VisualBasic.Strings

Syntax

StrDup(number,character)
number (required; Integer)

The number of times to duplicate the first character in string

character (required; String, Char, or Object containing a String or Char)

The String or Char whose first character is to be duplicated

Return Value

A String containing the character duplicated the specified number of times

Description

Returns a string that consists of the first character of character duplicated number times

Example

The line:

MsgBox(StrDup(Number:=5, Character:="ABC"))

displays "AAAAA".

VB.NET/VB 6 Differences

The StrDup function is new to VB.NET. It appears in part to be a replacement for the VB 6 String function.

Get VB.NET Language in a Nutshell, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.