| ExtensionsPadOrCut Method (String, UInt16) |
Shortens or extends a string to a specific length. The default position is
Right.
Namespace:
Cauldron
Assembly:
Cauldron (in Cauldron.dll) Version: 3.2.0.2
Syntax Parameters
- string
- Type: SystemString
The string to shorten or extend. - newlength
- Type: SystemUInt16
The new length of the string.
Return Value
Type:
String
A new string that is equivalent to this instance, but aligned to the left and padded or cropped on the right
with as many spaces as needed to create a length of
newlength. However, if
newlength
is equal to the length of this instance, the method returns a reference to the existing instance. If totalWidth is
0, the method returns
Empty.
Usage Note
In Visual Basic and C#, you can call this method as an instance method on any object of type
String. When you use instance method syntax to call this method, omit the first parameter. For more information, see
Extension Methods (Visual Basic) or
Extension Methods (C# Programming Guide).
Exceptions See Also