Class TrimLeft
- Namespace
- YndigoBlue.Velocity.Functions
- Assembly
- YndigoBlue.Velocity.dll
Represents the LTRIM (left trim) string function that removes leading whitespace.
public class TrimLeft : Function, ICheckItem, IDefaultItem, IFilterItem, IElement
- Inheritance
-
TrimLeft
- Implements
Remarks
The LTRIM function removes spaces and other whitespace characters from the beginning of a string, leaving trailing whitespace intact. This is useful for left-aligning text or removing indentation while preserving formatting at the end of strings.
Examples
Remove leading whitespace from imported address data:
var schema = manager.LoadSchema("imports");
var addresses = schema["addresses"];
var query = new Query()
.Select([ addresses["id"], new Expression("clean_street", new TrimLeft(addresses["street"])) ])
.From(addresses);
var results = manager.Retrieve(query);
Use the typed Column constructor when working with a pre-resolved column variable:
var schema = manager.LoadSchema("imports");
var addresses = schema["addresses"];
Column streetColumn = addresses["street"];
var query = new Query()
.Select([ addresses["id"], new Expression("clean_street", new TrimLeft(streetColumn)) ])
.From(addresses);
var results = manager.Retrieve(query);
Left-trim a hard-coded string literal to remove any leading whitespace:
var query = new Query()
.Select([ new Expression("trimmed", new TrimLeft(" hello")) ]);
var results = manager.Retrieve(query);
Constructors
- TrimLeft(IEnumerable<IElement>)
Initializes a new instance of LTRIM for multiple elements.
- TrimLeft(string)
Initializes a new instance of LTRIM for a string literal value.
- TrimLeft(IElement)
Initializes a new instance of LTRIM for a single element.
- TrimLeft(Column)
Initializes a new instance of LTRIM for a column.