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.PadRight (Int32)

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;

Parameters

totalWidth
The field width to justify in this string.

Return Value

This string is a right-aligned justified field width, padded with spaces as needed.

Exceptions

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

Remarks

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.

Example

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

See Also

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