Number Filters

Number Filters

abs filter

Returns the absolute value of a number.

abs

Will attempt to convert the input to a number before calculating the absolute value, and will return 0 if it is unable to convert the input to a number.

Related

at_least filter

Limits the input to a minimum value.

at_least: Number minimum

Converts both the input and the minimum values to numbers if they are not already numbers. If the input and minimum values cannot both be converted to numbers, return the unaltered input instead.

Related

at_most filter

Limits the input to a maximum value.

at_most: Number maximum

Converts both the input and the maximum values to numbers if they are not already numbers. If the input and maximum values cannot both be converted to numbers, return the unaltered input instead.

Related

ceil filter

Returns the next integer value greater than or equal to the input.

ceil

Attempts to converts the input to a number if it is not already a number. Returns null if it is unable to convert the input to a number.

Related

currency filter

Converts the input into a formatted currency as specified by language_tag.

currency: String language_tag

Attempts to convert the input to a number, and if it cannot be converted to a number, the currency filter will return the input as a string instead. If the input is null, returns null. Passing an invalid language_tag results in undefined behavior - likely resulting in a liquid error.

Related

divided_by filter

Divide the input by operand.

divided_by: Number operand

Related

floor filter

Returns the next integer value less than or equal to the input value.

floor

Attempts to converts the input to a number if it is not already a number. Returns null if it is unable to convert the input to a number.

Related

format_number filter

Returns the input formatted as a string using the provided format string. The format string must be a valid standard or custom .NET numeric format string.

format_number: String format

Returns null if the input cannot be converted to a number.

Related

number

Can be any number, including integers, decimals, or the value 0. Any value - including 0 - evaluates as true when used alone in a conditional.

minus filter

Subtracts the operand from the input.

minus: Number operand

Related

modulo filter

Return the remainder of the input when divided by the operand.

modulo: Number operand

If the input is negative, the result will also be negative. Otherwise the result will be positive.

Related

plus filter

Adds the operand to the current value. Note that this filter behaves differently if the current value is a string

plus: Number operand

The plus filter may behave differently when used with string input. When used with a string input it may append text to the current value, although that behavior is deprecated and should be replaced by the append filter for optimal forward-compatibility.

Related

round filter

Rounds the input to the specified number of decimal places.

round: Integer places

Attempts to converts the input to a number if it is not already a number. Returns null if it is unable to convert the input to a number, or if places is specified but cannot be converted to an integer. If the input is exactly halfway between the smaller and larger number, the round filter will attempt to round toward the nearest even number in the last decimal place (eg: 4.35 rounded to one decimal place would be 4.4)

Related

times filter

Multiply the input by the operand.

times: Number operand

This filter currently behaves differently if the input is a string and the operand is an integer. In that case the result is a list of strings with input repeated operand times.

Related

{{ time }}

Represents a specific instant in a specific timezone.

to_int filter

Converts the input to an integer.

to_int

If the input is null, returns 0. If the input is non-null and cannot be convert to an integer, returns null.

Related

to_number filter

Converts the input to a number.

to_number

If the input is null, returns 0. If the input is non-null and cannot be convert to an integer, returns null.

Related

number

Can be any number, including integers, decimals, or the value 0. Any value - including 0 - evaluates as true when used alone in a conditional.