Class PadRight
- Namespace
- Albatross.Expression.Prefix
- Assembly
- Albatross.Expression.dll
Prefix expression that pads a string to a specified total length by adding characters to the right. Takes 2-3 parameters: source string, total width, and optional padding character (defaults to space).
public class PadRight : PrefixExpression, IPrefixExpression, IExpression, IToken
- Inheritance
-
PadRight
- Implements
- Inherited Members
- Extension Methods
Constructors
PadRight()
Initializes a new instance of the PadRight class with name "PadRight" and 2-3 parameters.
public PadRight()
Fields
DefaultPaddingCharacter
The default padding character used when none is specified (space character).
public const char DefaultPaddingCharacter = ' '
Field Value
Methods
Run(List<object>)
Pads the input string to the specified total width by adding padding characters to the right. If the string is already longer than the target width, returns the original string unchanged.
protected override object Run(List<object> operands)
Parameters
operandsList<object>List containing 2-3 operands: source string, target width, and optional padding character.
Returns
- object
A string padded to the specified width with characters added to the right.
Exceptions
- FormatException
Thrown when operands cannot be converted to appropriate types.
- ArgumentOutOfRangeException
Thrown when the target width is negative.