Class FlowableExpressionStringUtils
java.lang.Object
com.flowable.platform.expressions.FlowableExpressionStringUtils
public class FlowableExpressionStringUtils
extends java.lang.Object
Expression Bean Name: flwStringUtils
Provides utilities to work with strings. For more formatting-centric functions, see
FlowableExpressionFormatUtils
.-
Constructor Summary
Constructors Constructor Description FlowableExpressionStringUtils()
-
Method Summary
Modifier and Type Method Description java.lang.String
capitalize(java.lang.String text)
Capitalizes a text, i.e.java.lang.String
carriageReturn()
Returns a carriage return character (\r)boolean
contains(java.lang.String text, java.lang.String otherText)
Checks if a strings contains another string.boolean
containsIgnoreCase(java.lang.String text, java.lang.String otherText)
Checks if a strings contains another string ignoring the case.boolean
equals(java.lang.String text, java.lang.String otherText)
Checks if two strings are the same.boolean
equalsIgnoreCase(java.lang.String text, java.lang.String otherText)
Checks if two strings are the same without taking capitalization into account.java.lang.String
escapeHtml(java.lang.String text)
Escapes the characters in aString
using HTML entities.boolean
hasText(java.lang.String text)
Checks whether a string contains text (is not null, empty)java.lang.String
join(java.util.Collection<java.lang.String> collection, java.lang.String delimiter)
Concatenates all entries of a list or collection to a single string.boolean
matches(java.lang.String text, java.lang.String regularExpression)
Checks whether a text matches a regular expression.java.lang.String
newline()
Returns a newline/linefeed character (\n)java.util.List<java.lang.String>
split(java.lang.String text, java.lang.String delimiter)
Splits a text into a collection with a given delimiter.java.lang.String
substring(java.lang.String text, int from, int to)
Gets all text between a character range.java.lang.String
substringFrom(java.lang.String text, int from)
Gets all text behind a certain character.java.lang.String
toLowerCase(java.lang.String text)
Turns all letters of a text to lowercase.java.lang.String
toUpperCase(java.lang.String text)
Turns all letters of a text to uppercase.java.lang.String
trimWhitespace(java.lang.String text)
Deletes all whitespaces from a textjava.lang.String
unescapeHtml(java.lang.String text)
Unescapes aString
containing entity escapes to a string containing the actual Unicode characters corresponding to the escapes.
-
Constructor Details
-
FlowableExpressionStringUtils
public FlowableExpressionStringUtils()
-
-
Method Details
-
toUpperCase
public java.lang.String toUpperCase(java.lang.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 java.lang.String toLowerCase(java.lang.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 java.lang.String capitalize(java.lang.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 java.lang.String trimWhitespace(java.lang.String text)Deletes all whitespaces from a text- Parameters:
text
- The text to be trimmed- Returns:
- The trimmed text
-
hasText
public boolean hasText(java.lang.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(java.lang.String text, java.lang.String otherText)Checks if a strings contains another string.- Parameters:
text
- The text to be checkedotherText
- The text that should be contained within the first text- Returns:
- Whether or not
otherText
is part oftext
.
-
containsIgnoreCase
public boolean containsIgnoreCase(java.lang.String text, java.lang.String otherText)Checks if a strings contains another string ignoring the case.- Parameters:
text
- The text to be checkedotherText
- The text that should be contained within the first text- Returns:
- Whether or not
otherText
is part oftext
.
-
matches
public boolean matches(java.lang.String text, java.lang.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 checkregularExpression
- The regular expression to check the text against- Returns:
- Whether or not the text matches the regular expression
-
equals
public boolean equals(java.lang.String text, java.lang.String otherText)Checks if two strings are the same. Consider using == instead.- Parameters:
text
- The first textotherText
- The second text- Returns:
- Whether or not the two texts are equal.
-
equalsIgnoreCase
public boolean equalsIgnoreCase(java.lang.String text, java.lang.String otherText)Checks if two strings are the same without taking capitalization into account.- Parameters:
text
- The first textotherText
- The second text- Returns:
- Whether or not the two texts are equal.
-
substring
public java.lang.String substring(java.lang.String text, int from, int to)Gets all text between a character range.- Parameters:
text
- The original textfrom
- The offset from the start beginning at 0to
- The offset from the end beginning at 0- Returns:
- The string between from and to
-
substringFrom
public java.lang.String substringFrom(java.lang.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 textfrom
- The character offset beginning at 0- Returns:
- The string set off by from
-
split
public java.util.List<java.lang.String> split(java.lang.String text, java.lang.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 splitdelimiter
- The splitter to be used- Returns:
- A list
-
join
public java.lang.String join(java.util.Collection<java.lang.String> collection, java.lang.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 objectdelimiter
- The separator between the entries, e.g. ", " or " and "- Returns:
- Joined String
-
newline
public java.lang.String newline()Returns a newline/linefeed character (\n)- Returns:
- Newline character
-
carriageReturn
public java.lang.String carriageReturn()Returns a carriage return character (\r)- Returns:
- Carriage return character
-
unescapeHtml
public java.lang.String unescapeHtml(java.lang.String text)Unescapes aString
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 java.lang.String escapeHtml(java.lang.String text)Escapes the characters in aString
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
-