System Namespace String Class
Left-aligns the characters in this string, padding with spaces on the right, for a specified total length.
[ VB ]
<Serializable>
Overloads Public Function PadRight ( _
ByVal totalWidth As Integer _
) As String
[ C# ]
[ Serializable ]
public string PadRight (
int totalWidth
);
[ C++ ]
[ Serializable ]
public: String* PadRight (
int totalWidth
);
[ JScript ]
public Serializable
function PadRight (
totalWidth : int
) : String;
- totalWidth
- The number of characters in the resulting string, equal to the number of original characters plus any additional padding characters.
A new String that is equivalent to this instance, but left-aligned and padded on the right with as many spaces as needed to create a length of totalWidth.
-or-
If totalWidth is less than the length of this instance, a new String that is identical to this instance.
A Unicode space is defined as hexadecimal 0x20.
[ VB ]
[ C++ ]
String *str = L"BBQ and Slaw";
Console::Write ( L"|" );
Console::Write ( str->PadRight ( 15 ) );
Console::WriteLine ( L"|" ); // Displays "|BBQ and Slaw |".
Console::Write ( L"|" );
Console::Write ( str->PadRight ( 5 ) );
Console::WriteLine ( L"|" ); // Displays "|BBQ and Slaw|".
[ JScript ]
var str : String;
str = "BBQ and Slaw";
Response.Write ( "|" );
Response.Write ( str.PadRight ( 15 ) );
Response.WriteLine ( "|" ); // Displays "|BBQ and Slaw |".
Response.Write ( "|" );
Response.Write ( str.PadRight ( 5 ) );
Response.WriteLine ( "|" ); // Displays "|BBQ and Slaw|".
String Members String.PadRight Overload List Int32 PadLeft Trim