Skip to content

downcase

The downcase filter is designed to convert all characters in a string to lowercase.

Functionality

  • Strings: Takes a string as input.
  • Conversion: Changes all uppercase letters to lowercase.
  • Output: Returns a new string with all lowercase letters.

Syntax

    {{ input_string | downcase }}

Arguments

The downcase filter does not require any arguments.

Code Samples

Example 1: Lowercasing a Sentence

    {% assign greeting = "HELLO, WORLD!" %}
    {{ greeting | downcase }}

Output:

hello, world!
Example 2: Lowercasing Mixed Case

    {% assign title = "ThIs Is A MiXeD CaSe TiTlE" %}
    {{ title | downcase }}

Output:

this is a mixed case title

Outliers and Special Cases

  • Empty Strings: If the input string is empty, the downcase filter returns an empty string.
  • Already Lowercase: If the input string is already in lowercase, the filter does not change the string.
  • Non-String Input: If the input is not a string, the downcase filter might attempt to convert it to a string or return an error, depending on how Experience Builder handles type conversions.

Key Points

  • The downcase filter is a simple but effective tool for normalizing text and ensuring consistency in case.
  • It is useful for comparing strings in a case-insensitive manner or for formatting text for display in lowercase.
  • Combine it with other string filters like upcase or capitalize for more complex text transformations.