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