Integer Functions
abs
ts
int.abs(): integerReturns the absolute value of an integer. If the integer is negative, it will return the positive value of it
Input Example:
textwire
{{ -5.abs() }}Output:
html
5decimal
ts
int.decimal(separator?: string = ".", decimals?: integer = 2): stringConverts to a string with a decimal part by appending a decimal separator and the number of decimal places. Here are some rules:
- When the string is not a number, it will return the string as is
- When the string is already a decimal number, it will return the string as is
- When you use it on a string, it will return the string as is if it's not a number
Arguments:
separator(str) (optional) - The separator to use for the decimal. Default is"."decimals(int) (optional) - The number of decimal places to add to the number. Default is2
Input Example:
textwire
{{ 123.decimal() }}Output:
html
123.00float
ts
int.float(): floatConverts an integer to a float by adding a decimal part of .0 to the number
Input Example:
textwire
{{ 5.float() }}Output:
html
5.0The value 0 will be converted to 0.0.
len
ts
int.len(): integerReturns the number of digits in an integer. If the integer is negative, it will return the number of digits excluding the - sign
Input Example:
textwire
{{ 12345.len() }}Output:
html
5str
ts
int.str(): stringConverts an integer to a string and returns it
Input Example:
textwire
{{ 5.str() }} and {{ -10.str() }}Output:
html
5 and -10