NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

String.PadLeft (Int32)

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;

Parameters

totalWidth
The field width to justify in this string.

Return Value

The PadLeft method this instance of string aligned from the left. This string as a left-aligned field with padded spaces as needed.

Exceptions

Exception Type Condition
ArgumentException If the field width is less than zero.

Remarks

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.

Example

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));

See Also

String Class | String Members | System Namespace | String.PadLeft Overload List | Int32