Class FlowableExpressionStringUtils
- java.lang.Object
-
- com.flowable.platform.expressions.FlowableExpressionStringUtils
-
public class FlowableExpressionStringUtils extends Object
Expression Bean Name: flwStringUtils Provides utilities to work with strings. For more formatting-centric functions, seeFlowableExpressionFormatUtils
.
-
-
Constructor Summary
Constructors Constructor Description FlowableExpressionStringUtils()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
capitalize(Object text)
Capitalizes a text, i.e.String
carriageReturn()
Returns a carriage return character (\r)boolean
contains(Object text, String otherText)
Checks if a strings contains another string.boolean
containsIgnoreCase(Object text, String otherText)
Checks if a strings contains another string ignoring the case.boolean
equals(Object text, String otherText)
Checks if two strings are the same.boolean
equalsIgnoreCase(Object text, String otherText)
Checks if two strings are the same without taking capitalization into account.String
escapeHtml(Object text)
Escapes the characters in an object using HTML entities.boolean
hasText(Object text)
Checks whether a string contains text (is not null, empty) Supports the following input: String Json TextNodenull
String
join(Collection<String> collection, String delimiter)
Concatenates all entries of a list or collection to a single string.boolean
matches(Object text, String regularExpression)
Checks whether a text matches a regular expression.String
newline()
Returns a newline/linefeed character (\n)List<String>
split(Object text, String delimiter)
Splits a text into a collection with a given delimiter.String
substring(Object text, int from, int to)
Gets all text between a character range.String
substringFrom(Object text, int from)
Gets all text behind a certain character.String
toLowerCase(Object text)
Turns all letters of an object to lowercase.String
toUpperCase(Object text)
Turns all letters of an object to uppercase.String
trimWhitespace(Object text)
Deletes all whitespaces from a text Supports the following input: String Json TextNodenull
String
unescapeHtml(Object text)
Unescapes aString
containing entity escapes to a string containing the actual Unicode characters corresponding to the escapes.
-
-
-
Method Detail
-
toUpperCase
public String toUpperCase(Object text)
Turns all letters of an object to uppercase. Supports the following input:- String
- Json TextNode
null
- Parameters:
text
- The text to be converted to uppercase- Returns:
- The text, converted to uppercase
-
toLowerCase
public String toLowerCase(Object text)
Turns all letters of an object to lowercase. Supports the following input:- String
- Json TextNode
null
- Parameters:
text
- The text to be converted to lowercase- Returns:
- The text, converted to lowercase
-
capitalize
public String capitalize(Object text)
Capitalizes a text, i.e. sets the first letter to uppercase. Supports the following input:- String
- Json TextNode
null
- Parameters:
text
- The text to be capitalized- Returns:
- The capitalized text
-
trimWhitespace
public String trimWhitespace(Object text)
Deletes all whitespaces from a text Supports the following input:- String
- Json TextNode
null
- Parameters:
text
- The text to be trimmed- Returns:
- The trimmed text
-
hasText
public boolean hasText(Object text)
Checks whether a string contains text (is not null, empty) Supports the following input:- String
- Json TextNode
null
- Parameters:
text
- The text to be checked- Returns:
- Whether or not the text contains any text
-
contains
public boolean contains(Object text, String otherText)
Checks if a strings contains another string. Supports the following input:- String
- Json TextNode
null
- 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(Object text, String otherText)
Checks if a strings contains another string ignoring the case. Supports the following input:- String
- Json TextNode
null
- 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(Object 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 Supports the following input:- String
- Json TextNode
null
- 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(Object text, String otherText)
Checks if two strings are the same. Supports the following input:- String
- Json TextNode
null
- Parameters:
text
- The first textotherText
- The second text- Returns:
- Whether or not the two texts are equal.
-
equalsIgnoreCase
public boolean equalsIgnoreCase(Object text, String otherText)
Checks if two strings are the same without taking capitalization into account. Supports the following input:- String
- Json TextNode
null
- Parameters:
text
- The first textotherText
- The second text- Returns:
- Whether or not the two texts are equal.
-
substring
public String substring(Object text, int from, int to)
Gets all text between a character range. Supports the following input:- String
- Json TextNode
null
- 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 String substringFrom(Object 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" Supports the following input:- String
- Json TextNode
null
- Parameters:
text
- The original textfrom
- The character offset beginning at 0- Returns:
- The string set off by from
-
split
public List<String> split(Object 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 then empty space is used. Supports the following input:- String
- Json TextNode
null
- Parameters:
text
- The text to be splitdelimiter
- 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 objectdelimiter
- 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(Object 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 '™'. Supports the following input:- String
- Json TextNode
null
- Parameters:
text
- The text to be unescaped- Returns:
- The unescaped text
-
escapeHtml
public String escapeHtml(Object text)
Escapes the characters in an object using HTML entities. For instance, in a text containing the character '™' would be escaped to '™'. Supports the following input:- String
- Json TextNode
null
- Parameters:
text
- The text to be escaped- Returns:
- The escaped text
-
-