Zoho Sites Help
Zoho Sites Help

Filters

 lower

This filter makes the string lowercase.

                

Syntax

{{ variable | lower }}

                

Example

{{ "xyzABC" | lower }}

                

Output

xyzabc

 upper

This filter makes the string uppercase.

        

Syntax

{{ variable | upper }}

        

Example

{{ "xyzABC" | upper }}

        

Output

XYZABC

 remove

This filter removes all occurrences of the given string from the main string.

        

Syntax

{{ variable | remove(String_variable) }}

        

Example

{{ "xyxxyxzABC" | remove("xy") }}

        

Output

xxzABC

 remove_first

This filter removes the first occurrence of the given string from the main string.

        

Syntax

{{ variable | remove_first(String_variable) }}

        

Example

{{ "xyxxyxzABC" | remove_first("xy") }}

        

Output

xxyxzABC

 append

This filter attaches the given string at the end of the main string.

        

Syntax

{{ variable | append(String_variable) }}

        

Example

{{ "xyxxy" | append("xy") }}

        

Output

xyxxyxy

 prepend

This filter attaches the given string at the beginning of the main string.

                

Syntax

{{ variable | prepend(String_variable) }}

                

Example

{{ "xyxxy" | prepend("xy") }}

                

Output

xyxyxxy

 trim

This filter returns the string with the trailing white space removed.

        

Syntax

{{ variable | trim }}

        

Example

{{ "xyxxyx    " | trim }}

        

Output

xyxxyx

 truncate

This filter reduces the number of string characters to the given value.

                

Syntax

{{ variable | truncate(number) }}

                

Example

{{ "xyxxyx" | truncate(3) }}

                

Output

xyx

 Capitalize

This filter capitalizes the first letter of the given string.

        

Syntax

{{ variable | capitalize }}

        

Example

{{ "cat Dog bat" | capitalize }}

        

Output

Cat dog bat

 camelize

This filter changes the given string to camel case. Camel case is also known as camel caps or medial capitals. Each word except the first in the sentence or phrase begins with a capital letter.

        

Syntax

{{ variable | camelize }}

        

Example

{{ "Cat Dog Bat" | camelize }}

        

Output

cat Dog Bat

 strip

This filter returns the string with the leading and trailing blank spaces removed.

        

Syntax

{{ variable | strip }}

        

Example

{{ "  abc  " | strip }}

        

Output

abc

 lstrip

This filter removes blank spaces, tabs, and new lines to the left of the string.

        

Syntax

{{ variable | Istrip }}

        

Example

{{ "     abc" | Istrip }}

        

Output

abc

 rstrip

This filter removes blank spaces, tabs, and new lines to the right of the string.

                

Syntax

{{ variable | rstrip }}

                

Example

{{ " def    " | Istrip }}

                

Output

def

 plus

This filter adds two numbers.

    

Syntax

{{ variable | plus(number) }}

    

Example

{{ % assign x=3 %}}

{{ 3 | plus (5) }}<br>

{{ x | plus (2.5) }}

    

Output

8

5.5

 minus

This filter finds the difference between two numbers.

        

Syntax

{{ variable | minus(number) }}

        

Example

{{ % assign x=3%}}

{{ 3 | minus(5) }}<br>

{{ x | minus(2.5) }}

        

 Output       

-2 

0.5

 multiply

Syntax

{{ variable | multiply(number) }}

                

Example

{{ % assign x=3 %}}

{{ 3 | multiply(5) }}<br>

{{ x | multiply(2.5) }}

                

Output

15

7.5

 divide

This filter finds the quotient by dividing two numbers.

                

Syntax

{{ variable | divide(number) }}

                

Example

{{ % assign x=3 %}}

{{ 2 | divide(5) }}<br>

{{ x | divide(1.5) }}

                

Output

0.4

2

 modulo

This filter finds the modulo of two numbers.

                

Syntax

{{ variable | modulo(number) }}

                

Example

{{ % assign x=3 %}}

{{ 13 | modulo(5) }}<br>

{{ x | modulo(2) }}

                

Output

3

1

 abs

This filter finds the absolute value of the given number.

  

Syntax

{{ variable | abs }}

  

Example

{{ % assign x=-3 %}}

{{ % assign y=(-4.3)

{{ x | abs }}<br>

{{ y | abs}} 

  

Output

3

4.3

 power

This filter finds the power of the number.

 

Syntax

{{ variable | power(number) }}

 

Example

{{ % assign x=2 %}}

{{ 25 | power(3) }}<br>

{{ x | power(15) }}

 

Output

3125

32768

 Currency

This filter displays the data in the specified currency format.


Syntax

 

Attributes:

  • symbol*
  • format*
  • code
  • symbol_on_left( true/false )
  • code_on_left( true/false )

*mandatory


Additional Attributes:

  • with_symbol
  • without_symbol
  • with_code
  • without_code
  • with_decimal_separator
  • without_decimal_separator
  • with_integer_part
  • without_integer_part
  • with_fractional_part
  • without_fractional_part


Example

{% assign currency=" {}" %} 
{% assign currency.code="USD" %} 
{% assign currency.symbol="$" %} 
{% assign currency.format="##,##,##0.00" %} 
{% assign currency.symbol_on_left=true %} 
{% assign currency.code_on_left=true %}

{% assign h=123564.56%}
{{ h | currency(currency, "with_symbol""with_code""with_decimal_separator""with_integer_part""with_fractional_part") }}

 

Output

USD $1,23,564.56

 fileSizeFormat

This filter converts the given value from a byte to a higher unit.

 

Syntax

{{ variable | fileSizeFormat }}

 

Example

{{ % assign x=1000000000%}

{{ x | fileSizeFormat }}

 

Output

953.67MB

 size

This filter returns the size (the number of characters) of the given string.

  

Syntax

{{ variable | size }}

  

Example

{{ % assign x="hello" %}} 

{{ x | size }}

  

Output

5

 date

Syntax

{{ variable | date }}<br>
{{ variable | date(format_string) }}

 

Example

{{ 1475144184 | date}}
{{ 1475144184 | date("YY-MM-dd")}}

Output
Thu Sep 2915:46:24 IST 2016
16-09-29

 objType

This filter returns the object type of the given value.

  

Syntax

{{ variable | objType}}

  

Example

{ % assign x=55 %}

{ % assign y="hi" %}

{{ x | objType }}<br>

{{ y | objType}}

  

Output

Integer 

String

 toString

Syntax

{{ variable | toString }}

 

Example

{ % assign x=55 %}

{ % assign y="hi" %}

{{ x | toString }}<br>

{{ y | toString}}

 

Output

55

hi

 first

This filter returns the first character of the String.

 

Syntax

{{ variable | first }}

 

Example

{ % assign y="bluebells" %}

{{ y | first }}

 

Output

b

 last

This filter returns the last character of the string.

 

Syntax

{{ variable | last }}

 

Example

{ % assign y="blue bells" %}

{{ y | last }}

 

Output

s

 dictsort

This filter sorts the given values in dictionary, i.e., alphabetical order.

 

Syntax

{{ map_variable | dictsort }}

 

Example

{ % assign map2="{"ant" : "black""dog" : "brown" "cat" : "yellow"} %}


{{ map2 | dictsort }}

 

Output

{ant=black, cat="yellow," dog="brown}

 escHtml

Syntax

{{ variable | escHtml }}

 

Example

{ % assign x="<hi>how are you" %}


{{ x | escHtml }}

 

Output

The value stored is &lt;hi&gt;how are you

 urlize

This filter converts the given string into a URL.

 

 

Syntax

{{ URL_string | urlize }}

{{ URL_string | urlize (truncate_int) }}

 

Example

{ % assign x="www.google.com" %}

{{ x | urlize }}<br>

{{ x | urlize(5) }}

 

Output

www.google.com

www.g...

 floatValue

This filter returns the given value as a decimal.

 

Syntax

{{ URL_string | floatValue }}

 

Example

{ % assign x=2 %}

{{ x | floatValue }}

 

Output

2.0

 hasElement

This filter returns either 'true' or 'false' based on whether the given element exists within thestring.

 

Syntax

{{ variable | hasElement(variable) }}

 

Example

{ % assign x="{"a" "b""c" : "d"} %}

{{ x | hasElement ("a") }}

<br>

{{x | hasElement ("x") }}


Output

true 

false

 pluralize

This filter gives the required value in singular or plural form. The default plural string to be added is 's'. The list is taken as a plural if the size of the list is greater than 1.

  

Syntax

{{ variable | pluralize }}

{{ variable | pluralize(plural_string }}

{{ variable | pluralize(singular_string,plural_string) }}

  

Example

{ % assign x="[" {"a" : "b"} , {"c" : "d"} ] %}

{% assign y=[ {"e""f"} ] %}

{{x | pluralize } }

<br>

{{ x | pluralize ("ss") }}

<br>

{{y | pluralize("a" "b") }}

  

Output

s

ss

a

 length

This filter gives the length of the given list.

 

Syntax

{{ variable | length }}

 

Example

{ % assign x="[{"a" : "b"} , {"c" : "d"}] %}

{{ x | length }}

 

Output

2

 entries

This filter is used to map entries.

 

Syntax

{{ variable | entries }}

 

Example

{ % assign x={"a" : "b" "e""f""c" : "d"} %}

{{ x | entries }}

 

Output

[a=b, c="d," e="f]

 batch

This filter returns a list of lists with the given number of items. The second parameter is used to fill the missing items.

 

Syntax

{{ variable | batch(number_of_items_,fill_parameter) }}

 

Example

{ % assign x={"a" "b"} , {"c" "d"} , {"e" : "f"} %}

{{ x | batch(5, "test" ) }}

 

Output

[{"a" "b"} , {"c""d"} , {"e" : "f"}, "test""test"]

 map

This filter maps a single attribute from a list to apply a filter to.

 

Syntax

{{ variable | map(attr="attr_name",prefix="prefix_name",upper/lower) }}

 

Example

{% assign x="[{"a":"one","b":"two"},{"a":"three","b":"four"},{"a":"five","b":"six"}] %}
{{ x | map(attr="a",prefix="a",lower) }}
<br>
{{ x | map(attr="b",prefix="b",upper) }}

 

Output

[a one, a three, a five] 
[B TWO, B FOUR, B SIX]

 splitFirst

This filter splits the first half of the string with a delimiter.

 

Syntax

{{ variable | splitFirst(delimiter) }}

 

Example

{ % assign x="test.string" %}

{{ x | splitFirst(" . ") }}


Output

test

 splitLast

This filter splits the first half of the string with a delimiter.

  

Syntax

{{ variable | splitLast(delimiter) }}

  

Example

{ % assign x="test.string" %}

{{ x | splitLast(" . ") }}


Output

string

 date

This filter converts the given date format to another date format. The input and output formats are given as a parameter using a string.

 

Syntax

{{ variable | date(inputFormat,outputFormat) }}

 

Example

{% assign date1="2017-03-14 18:41:31.0" %}

{{ date1 | dateFormat("yyyy-MM-dd HH:mm:ss","M-d-yy")}}

Output 

3-14-17

 

Sample Date Patterns


Input String

Pattern

2001.07.04 AD at 12:08:56 PDT 

yyyy.MM.dd G 'at' HH:mm:ss z

Wed, Jul 4, '01 

EEE, MMM d, ''yy

12:08 PM 

h:mm a

12 o'clock PM, Pacific Daylight Time 

hh 'o''clock' a, zzzz

0:08 PM, PDT 

K:mm a, z

02001.July.04 AD 12:08 PM 

yyyyy.MMMM.dd GGG hh:mm aaa

010704120856-0700 

yyMMddHHmmssZ

2001-07-04T12:08:56.235-0700 

yyyy-MM-dd'T'HH:mm:ss.SSSZ

2001-07-04T12:08:56.235-07:00 

yyyy-MM-dd'T'HH:mm:ss.SSSXXX

2001-W27-3 

YYYY-'W'ww-u

Wed, 4 Jul 2001 12:08:56 -0700 

EEE, d MMM yyyy HH:mm:ss Z