Class Right
- Namespace
- YndigoBlue.Velocity.Functions
- Assembly
- YndigoBlue.Velocity.dll
Represents the RIGHT string function that returns a specified number of characters from the end of a string.
public class Right : Function, ICheckItem, IDefaultItem, IFilterItem, IElement
- Inheritance
-
Right
- Implements
Remarks
The RIGHT function extracts the rightmost characters from a string. This is useful for extracting suffixes, file extensions, or the end portion of identifiers. If the length exceeds the string length, the entire string is returned.
Examples
Extract the last four characters of a reference number as the check digits:
var schema = manager.LoadSchema("finance");
var transactions = schema["transactions"];
var query = new Query()
.Select([ transactions["id"], new Expression("check_digits", new Right(transactions["reference"], 4)) ])
.From(transactions);
var results = manager.Retrieve(query);
Constructors
- Right(Column, int)
Initializes a new instance of RIGHT with a literal length.
- Right(Column, Column)
Initializes a new instance of RIGHT with a column-based length.
- Right(Expression, int)
Initializes a new instance of RIGHT for a string expression.