Returns this string left-aligned in a field of specified width.
[Visual Basic] Overloads Public Function PadLeft( _ ByVal totalWidth As Integer _ ) As String [C#] public string PadLeft( int totalWidth ); [C++] public: String* PadLeft( int totalWidth ); [JScript] public function PadLeft( totalWidth : int ) : String;
The PadLeft method this instance of string aligned from the left. This string as a left-aligned field with padded spaces as needed.
Exception Type | Condition |
---|---|
ArgumentException | If the field width is less than zero. |
The PadLeft method this instance of string aligned from the left. If the field width is less than the string's length, the string is returned unaltered.
Visual Basic: [VB] Dim foo As String foo = "BBQ and Slaw" Console.WriteLine(foo.PadLeft(25)) Console.WriteLine(foo.PadLeft(5)) Managed C++: [C++] String foo = L"BBQ and Slaw"; Console::WriteLine (foo->PadLeft (25)); Console::WriteLine (foo->PadLeft (5));
String Class | String Members | System Namespace | String.PadLeft Overload List | Int32