String(int,char)

  • Thread starter Thread starter GG
  • Start date Start date
GG,
You can use:

System.String.New(Char, Integer)

Dim str As String
str = New String("x"c, 5)


Microsoft.VisualBasic.StrDup(Integer, Char)

Microsoft.VisualBasic.StrDup(Integer, Object)

Microsoft.VisualBasic.StrDup(Integer, String)

str = StrDup(5, "x"c)
str = StrDup(5, "xx")


System.String.PadLeft(Integer, Char)

System.String.PadRight(Integer, Char)

str = String.Empty.PadLeft(5, "x"c)

I normally use the first one, the StrDup is the String function from VB6.

The last two requires an existing string, so I normally would not use them
for this per se, I would use them when I needed to pad an existing string to
a certain number of characters...

Hope this helps
Jay
 
Yes very much so.

Thank you very much Jay.

Jay B. Harlow said:
GG,
You can use:

System.String.New(Char, Integer)

Dim str As String
str = New String("x"c, 5)


Microsoft.VisualBasic.StrDup(Integer, Char)

Microsoft.VisualBasic.StrDup(Integer, Object)

Microsoft.VisualBasic.StrDup(Integer, String)

str = StrDup(5, "x"c)
str = StrDup(5, "xx")


System.String.PadLeft(Integer, Char)

System.String.PadRight(Integer, Char)

str = String.Empty.PadLeft(5, "x"c)

I normally use the first one, the StrDup is the String function from VB6.

The last two requires an existing string, so I normally would not use them
for this per se, I would use them when I needed to pad an existing string to
a certain number of characters...

Hope this helps
Jay
 
Back
Top