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 AWS CYBERSECURITY DATA SCIENCE
     ❯   

Filter Reference


Filter Reference

A list of all filter keywords:

Keyword Description
add Adds a specified value.
addslashes Adds a slash before any quote characters, to escape strings.
capfirst Returns the first letter in uppercase.
center Centers the value in the middle of a specified width.
cut Removes any specified character or phrases.
date Returns dates in the specified format.
default Returns a specified value if the value is False.
default_if_none Returns a specified value if the value is None.
dictsort Sorts a dictionary by the given value.
dictsortreversed Sorts a dictionary reversed, by the given value.
divisibleby Returns True if the value can be divided by the specified number, otherwise it returns False.
escape Escapes HTML code from a string.
escapejs Escapes JavaScript code from a string.
filesizeformat Returns a number into a file size format.
first Returns the first item of an object (for Strings, the first character is returned).
floatformat Rounds floating numbers to a specified number of decimals, default one decimal.
force_escape Escapes HTML code from a string.
get_digit Returns a specific digit of a number.
iriencode Convert an IRI into a URL friendly string.
join Returns the items of a list into a string.
json_script Returns an object into a JSON object surrounded by <script></script> tags.
last Returns the last item of an object (for Strings, the last character is returned).
length Returns the number of items in an object, or the number of characters in a string.
length_is Returns True if the length is the same as the specified number
linebreaks Returns the text with <br> instead of line breaks, and <p> instead of more than one line break.
linebreaksbr Returns the text with <br> instead of line breaks.
linenumbers Returns the text with line numbers for each line.
ljust Left aligns the value according to a specified width
lower Returns the text in lower case letters.
make_list Converts a value into a list object.
phone2numeric Converts phone numbers with letters into numeric phone numbers.
pluralize Adds a 's' at the end of a value if the specified numeric value is not 1.
pprint  
random Returns a random item of an object
rjust Right aligns the value according to a specified width
safe Marks that this text is safe and should not be HTML escaped.
safeseq Marks each item of an object as safe and the item should not be HTML escaped.
slice Returns a specified slice of a text or object.
slugify Converts text into one long alphanumeric-lower-case word.
stringformat Converts the value into a specified format.
striptags Removes HTML tags from a text.
time Returns a time in the specified format.
timesince Returns the difference between two datetimes.
timeuntil Returns the difference between two datetimes.
title Upper cases the first character of each word in a text, all other characters are converted to lower case.
truncatechars Shortens a string into the specified number of characters.
truncatechars_html Shortens a string into the specified number of characters, not considering the length of any HTML tags.
truncatewords Shortens a string into the specified number of words.
truncatewords_html Shortens a string into the specified number of words, not considering any HTML tags.
unordered_list Returns the items of an object as an unordered HTML list.
upper Returns the text in upper case letters.
urlencode URL encodes a string.
urlize Returns any URLs in a string as HTML links.
urlizetrunc Returns any URLs in a string as HTML links, but shortens the links into the specified number of characters.
wordcount Returns the number of words in a text.
wordwrap Wrap words at a specified number of characters.
yesno Converts Booleans values into specified values.
i18n  
l10n  
tz  

×

Contact Sales

If you want to use W3Schools services as an educational institution, team or enterprise, send us an e-mail:
[email protected]

Report Error

If you want to report an error, or if you want to make a suggestion, send us an e-mail:
[email protected]

W3Schools is optimized for learning and training. Examples might be simplified to improve reading and learning. Tutorials, references, and examples are constantly reviewed to avoid errors, but we cannot warrant full correctness of all content. While using W3Schools, you agree to have read and accepted our terms of use, cookie and privacy policy.

Copyright 1999-2024 by Refsnes Data. All Rights Reserved. W3Schools is Powered by W3.CSS.