Menu
   ❮   
HTML CSS JAVASCRIPT SQL PYTHON JAVA PHP HOW TO W3.CSS C C++ C# BOOTSTRAP REACT MYSQL JQUERY EXCEL XML DJANGO NUMPY PANDAS NODEJS R TYPESCRIPT ANGULAR GIT POSTGRESQL MONGODB ASP AI GO KOTLIN SASS VUE DSA GEN AI SCIPY CYBERSECURITY DATA SCIENCE
     ❯   

Template Filter - length


Example

Return the number of items in a list:

<h1>{{ fruits|length }}</h1>
Run Example »

Definition and Usage

The length filter returns the number of items in an object.

For strings, the length filter returns the number of characters:

Example

Return the number of characters in a string:

<h1>{{ firstname|length }}</h1>
Run Example »

Syntax

Template filters are defined by using a pipe | character followed by the name of the filter.

{{ value|length }}