Skip to content

upcase

The upcase filter is designed to convert all characters in a string to uppercase. It is a simple yet essential tool for text manipulation and formatting.

Functionality

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

Syntax

    {{ input_string | upcase }}
Arguments

The upcase filter does not require any arguments.

Code Samples

Example 1: Uppercasing a Sentence

    {% assign greeting = "hello, world!" %}

    {{ greeting | upcase }}

Output:

HELLO, WORLD!
Example 2: Uppercasing Mixed Case
    {% assign title = "This Is a Mixed Case Title" %}
    {{ title | upcase }}
Output:
THIS IS A MIXED CASE TITLE

Outliers and Special Cases

  • Empty Strings: If the input string is empty, the upcase filter returns an empty string.
  • Already Uppercase: If the input string is already in uppercase, the filter does not change the string.
  • Non-String Input: If the input is not a string, the upcase filter might attempt to convert it to a string or return an error, depending on how Experience Builder handles type conversions.
  • Special Characters: Special characters and punctuation marks are not affected by the upcase filter.

Key Points

  • The upcase filter is a basic but useful string manipulation tool for changing the case of text.
  • It is commonly used for formatting text for display in uppercase, especially for headings, titles, or emphasis.
  • It can also be used in combination with other string filters like downcase or capitalize for more complex text transformations.