PadLeft, PadRight and PadCenter : String Pad « Data Type « VB.Net Tutorial






Public Class Tester
    Public Shared Sub Main
        Dim content1 As String
        Dim content2 As String
        Dim content3 As String
        Dim content4 As String

        content1 = "Not padded"
        content2 = "PadLeft".PadLeft(50)
        content3 = "PadRight".PadRight(50)
        content4 = "PadCenter"
        content4 = content4.PadLeft((50 + _
           content4.Length) \ 2).PadRight(50)
        Console.WriteLine(String.Format("{0}{4}{1}{4}{2}{4}{3}", _
           content1, content2, content3, content4, vbNewLine))    

    End Sub


End Class
Not padded
                                           PadLeft
PadRight
                    PadCenter








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