Table of Contents

Class PadLeft

Namespace
Albatross.Expression.Prefix
Assembly
Albatross.Expression.dll

Prefix expression that pads a string to a specified total length by adding characters to the left. Takes 2-3 parameters: source string, total width, and optional padding character (defaults to space).

public class PadLeft : PrefixExpression, IPrefixExpression, IExpression, IToken
Inheritance
PadLeft
Implements
Inherited Members
Extension Methods

Constructors

PadLeft()

Initializes a new instance of the PadLeft class with name "PadLeft" and 2-3 parameters.

public PadLeft()

Fields

DefaultPaddingCharacter

The default padding character used when none is specified (space character).

public const char DefaultPaddingCharacter = ' '

Field Value

char

Methods

Run(List<object>)

Pads the input string to the specified total width by adding padding characters to the left. If the string is already longer than the target width, returns the original string unchanged.

protected override object Run(List<object> operands)

Parameters

operands List<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 left.

Exceptions

FormatException

Thrown when operands cannot be converted to appropriate types.

ArgumentOutOfRangeException

Thrown when the target width is negative.