Class FlowableExpressionStringUtils


  • public class FlowableExpressionStringUtils
    extends Object
    Expression Bean Name: flwStringUtils Provides utilities to work with strings. For more formatting-centric functions, see FlowableExpressionFormatUtils.
    • Constructor Detail

      • FlowableExpressionStringUtils

        public FlowableExpressionStringUtils()
    • Method Detail

      • toUpperCase

        public String toUpperCase​(String text)
        Turns all letters of a text to uppercase.
        Parameters:
        text - The text to be converted to uppercase
        Returns:
        The text, converted to uppercase
      • toLowerCase

        public String toLowerCase​(String text)
        Turns all letters of a text to lowercase.
        Parameters:
        text - The text to be converted to lowercase
        Returns:
        The text, converted to lowercase
      • capitalize

        public String capitalize​(String text)
        Capitalizes a text, i.e. sets the first letter to uppercase.
        Parameters:
        text - The text to be capitalized
        Returns:
        The capitalized text
      • trimWhitespace

        public String trimWhitespace​(String text)
        Deletes all whitespaces from a text
        Parameters:
        text - The text to be trimmed
        Returns:
        The trimmed text
      • hasText

        public boolean hasText​(String text)
        Checks whether a string contains text (is not null, empty)
        Parameters:
        text - The text to be checked
        Returns:
        Whether or not the text contains any text
      • contains

        public boolean contains​(String text,
                                String otherText)
        Checks if a strings contains another string.
        Parameters:
        text - The text to be checked
        otherText - The text that should be contained within the first text
        Returns:
        Whether or not otherText is part of text.
      • containsIgnoreCase

        public boolean containsIgnoreCase​(String text,
                                          String otherText)
        Checks if a strings contains another string ignoring the case.
        Parameters:
        text - The text to be checked
        otherText - The text that should be contained within the first text
        Returns:
        Whether or not otherText is part of text.
      • matches

        public boolean matches​(String text,
                               String regularExpression)
        Checks whether a text matches a regular expression. Example: #{flwStringUtils.matches('CHF 1000', 'CHF \d*'))} = true Example: #{flwStringUtils.matches('EUR 1000', 'CHF \d*'))} = false
        Parameters:
        text - The text to check
        regularExpression - The regular expression to check the text against
        Returns:
        Whether or not the text matches the regular expression
      • equals

        public boolean equals​(String text,
                              String otherText)
        Checks if two strings are the same. Consider using == instead.
        Parameters:
        text - The first text
        otherText - The second text
        Returns:
        Whether or not the two texts are equal.
      • equalsIgnoreCase

        public boolean equalsIgnoreCase​(String text,
                                        String otherText)
        Checks if two strings are the same without taking capitalization into account.
        Parameters:
        text - The first text
        otherText - The second text
        Returns:
        Whether or not the two texts are equal.
      • substring

        public String substring​(String text,
                                int from,
                                int to)
        Gets all text between a character range.
        Parameters:
        text - The original text
        from - The offset from the start beginning at 0
        to - The offset from the end beginning at 0
        Returns:
        The string between from and to
      • substringFrom

        public String substringFrom​(String text,
                                    int from)
        Gets all text behind a certain character. Please note that the parameter is zero-based. Example: #{flwStringUtils.substringFrom("hello", 0) = "hello" Example: #{flwStringUtils.substringFrom("hello", 1) = "ello"
        Parameters:
        text - The original text
        from - The character offset beginning at 0
        Returns:
        The string set off by from
      • split

        public List<String> split​(String text,
                                  String delimiter)
        Splits a text into a collection with a given delimiter. The delimiter can be a single character, e.g. a semicolon or a regular expression. If there is no delimiter available, a list with a single element will be returned.
        Parameters:
        text - The text to be split
        delimiter - The splitter to be used
        Returns:
        A list
      • join

        public String join​(Collection<String> collection,
                           String delimiter)
        Concatenates all entries of a list or collection to a single string. Example: #{flwStringUtils.join(customers, ', '}}
        Parameters:
        collection - A collection, list or any other iterable object
        delimiter - The separator between the entries, e.g. ", " or " and "
        Returns:
        Joined String
      • newline

        public String newline()
        Returns a newline/linefeed character (\n)
        Returns:
        Newline character
      • carriageReturn

        public String carriageReturn()
        Returns a carriage return character (\r)
        Returns:
        Carriage return character
      • unescapeHtml

        public String unescapeHtml​(String text)
        Unescapes a String containing entity escapes to a string containing the actual Unicode characters corresponding to the escapes. For instance, in a text containing the character '™' would be unescaped to '™'.
        Parameters:
        text - The text to be unescaped
        Returns:
        The unescaped text
      • escapeHtml

        public String escapeHtml​(String text)
        Escapes the characters in a String using HTML entities. For instance, in a text containing the character '™' would be escaped to '™'.
        Parameters:
        text - The text to be escaped
        Returns:
        The escaped text