Table of Contents

Class Trim

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

Represents the TRIM string function that removes leading and trailing whitespace.

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

Remarks

The TRIM function removes spaces and other whitespace characters from both the beginning and end of a string. The specific whitespace characters removed may vary by database system. This function is useful for cleaning user input and normalizing data.

Examples

Trim leading and trailing whitespace from customer names:

var schema = manager.LoadSchema("crm");
var customers = schema["customers"];

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

var results = manager.Retrieve(query);

Constructors

Trim(IEnumerable<IElement>)

Initializes a new instance of TRIM for a composed expression (e.g. TRIM(col)).

Trim(IElement)

Initializes a new instance of TRIM for any element.

Trim(Column)

Initializes a new instance of TRIM for a column.

Trim(Expression)

Initializes a new instance of TRIM for an expression.