Table of Contents

Class TrimRight

Namespace
YndigoBlue.Velocity.Functions
Assembly
YndigoBlue.Velocity.dll

Represents the RTRIM (right trim) string function that removes trailing whitespace.

public class TrimRight : Function, ICheckItem, IDefaultItem, IFilterItem, IElement
Inheritance
TrimRight
Implements

Remarks

The RTRIM function removes spaces and other whitespace characters from the end of a string, leaving leading whitespace intact. This is useful for removing padding while preserving indentation or other leading formatting.

Examples

Remove trailing whitespace from product names before display:

var schema = manager.LoadSchema("catalog");
var products = schema["products"];

var query = new Query()
    .Select([ products["id"], new Expression("clean_name", new TrimRight(products["name"])) ])
    .From(products);

var results = manager.Retrieve(query);

Use the typed Column constructor when working with a pre-resolved column variable:

var schema = manager.LoadSchema("catalog");
var products = schema["products"];
Column nameColumn = products["name"];

var query = new Query()
    .Select([ products["id"], new Expression("clean_name", new TrimRight(nameColumn)) ])
    .From(products);

var results = manager.Retrieve(query);

Right-trim a hard-coded string literal to remove trailing whitespace:

var query = new Query()
    .Select([ new Expression("trimmed", new TrimRight("hello   ")) ]);

var results = manager.Retrieve(query);

Constructors

TrimRight(IEnumerable<IElement>)

Initializes a new instance of RTRIM for multiple elements.

TrimRight(string)

Initializes a new instance of RTRIM for a string literal value.

TrimRight(IElement)

Initializes a new instance of RTRIM for a single element.

TrimRight(Column)

Initializes a new instance of RTRIM for a column.