System Namespace String Class
Right-aligns the characters in the given String, padding on the left with spaces or a specified Unicode character for a specified total length.
1. Right-aligns the characters in the given String, padding with spaces on the left for a specified total length.
2. Right-aligns the characters in the given String, padding on the left with a specified Unicode character for a specified total length.
NOTE: This example shows how to use one of the overloaded versions of PadLeft. For other examples that might be available, see the individual overload topics.
[ VB ]
Dim str As String
Dim bar As Char
str = "forty-two"
bar = "."c
Response.WriteLine ( str.PadLeft ( 15, bar ) ) ' Displays "......forty-two".
Response.WriteLine ( str.PadLeft ( 2, bar ) ) ' Displays "forty-two".
[ C++ ]
String *str = L"forty-two";
Console::WriteLine ( str-> PadLeft ( 15, L'.' ) ); // Displays "......forty-two".
Console::WriteLine ( str-> PadLeft ( 2, L'.' ) ); // Displays "forty-two".
[ JScript ]
var str : String;
var pad : char;
str = "forty-two";
pad = ".";
Response.WriteLine ( str.PadLeft ( 15, pad ) ) // Displays "......forty-two".
Response.WriteLine ( str.PadLeft ( 2, pad ) ) // Displays "forty-two".
String Members