String.Pad : String Pad « Data Type « VB.Net Tutorial






public class Test
   public Shared Sub Main
        Dim strLeftPad, strRightPad As String

        strLeftPad = "[" & "Visual Basic Express".PadLeft(28) & "]"
        strRightPad = "[" & "Visual Basic Express".PadRight(28) & "]"
        Console.WriteLine(strLeftPad & vbCrLf & strRightPad)

        strLeftPad = "[" & "Visual Basic Express".PadLeft(28, "@") & "]"
        strRightPad = "[" & "Visual Basic Express".PadRight(28, ".") & "]"
        Console.WriteLine(strLeftPad & vbCrLf & strRightPad)

   End Sub
End class
[        Visual Basic Express]
[Visual Basic Express        ]
[@@@@@@@@Visual Basic Express]
[Visual Basic Express........]








2.35.String Pad
2.35.1.String.Pad
2.35.2.PadLeft, PadRight and PadCenter
2.35.3.PadLeft, PadRight and PadCenter with dot