Interface StringFunctionsLocal
-
public interface StringFunctionsLocalString methods for data processing
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringMAPPED_NAMEstatic java.lang.CharSequenceNEWLINE
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.util.List<java.lang.String>base64decode(java.util.List<java.lang.String> input)Base64 decode all input strings.java.util.List<java.lang.String>base64encode(java.util.List<java.lang.String> input, int chunkSize)Base64 encode all input stringsjava.util.List<java.lang.String>capitalize(java.util.List<java.lang.String> input)Capitalize strings, i.e.: convert all word starts to uppercasejava.util.List<java.lang.String>defaultStringIfNoResult(java.util.List<java.lang.String> in, java.lang.String defaultString)Returns a default string for each element in the input list, which is null resp.java.util.List<java.lang.String>emptyStringIfNoResult(java.util.List<java.lang.String> in)Returns an empty string for each element in the input list, which is null or a single empty string, if the input list is null or empty.java.util.List<java.lang.String>formatPrice(java.util.List<java.lang.String> input, java.lang.String decimalPlaceCharacter, java.lang.String formatString)Format price with decimalPlaceCharacter and formatString using FormatUtils class.java.util.List<java.lang.String>htmlToPlainText(java.util.List<java.lang.String> input)Convert HTML to plain text, i.e.java.util.List<java.lang.String>inverseMatch(java.util.List<java.lang.String> input, java.lang.String pattern)Return strings that do NOT match the given regular expressionjava.util.List<java.lang.String>join(java.util.List<java.lang.String> input, java.lang.String prefix, java.lang.String delimiter, java.lang.String suffix, int minimumElements)Join strings from input list and return a single string containing all strings concatenated according to these instructions: insert prefix before the first string append delimiter to each string except the last one append suffix to the last string omit prefix and suffix if the input list contains less than minimum elementsjava.util.List<java.lang.String>leftPad(java.util.List<java.lang.String> input, int maxLength, java.lang.String pad, boolean truncate)Left pad a string up to a maximum length.java.util.List<java.lang.String>leftTrim(java.util.List<java.lang.String> input)Trim whitespaces from start of all stringsjava.util.List<java.lang.String>lowercase(java.util.List<java.lang.String> input)Turn all strings to lowercasejava.util.List<java.lang.String>match(java.util.List<java.lang.String> input, java.lang.String pattern)Return strings that match the given regular expressionjava.util.List<java.lang.String>md5(java.util.List<java.lang.String> input)Calculate and return the md5 checksum for each string.java.util.List<java.lang.String>replace(java.util.List<java.lang.String> input, java.lang.String search, java.lang.String replace)Replace all occurrences of String search by replacejava.util.List<java.lang.String>replaceHtmlBreaks(java.util.List<java.lang.String> input)Replace all HTML breaks by new linesjava.util.List<java.lang.String>replaceRegEx(java.util.List<java.lang.String> input, java.lang.String searchPattern, java.lang.String replace)Replace all occurrences of regular expression searchPattern by replacejava.util.List<java.lang.String>reverse(java.util.List<java.lang.String> input)Reverse stringsjava.util.List<java.lang.String>rightPad(java.util.List<java.lang.String> input, int maxLength, java.lang.String pad, boolean truncate)Right pad a string up to a maximum length.java.util.List<java.lang.String>rightTrim(java.util.List<java.lang.String> input)Trim whitespaces from end of all stringsjava.util.List<java.lang.String>sanitize(java.util.List<java.lang.String> input)"Sanitize" strings, i.e.: remove double whitespaces remove all non-printable charactersjava.util.List<java.lang.String>smartTruncate(java.util.List<java.lang.String> input, int maxLength, boolean wordSafe, int threshold)Truncate strings to the given maximum length.
If the string is longer, append three dots at the end, so that the result string including the dots has a maximum length of maxLength characters.
If wordSafe is set to true, also try to truncate at word ends - unless this would result in a string shorter then (maxLength - threshold), in this case ignore the wordSafe option.
Regardless of the wordSafe option, the entire string is returned, if it's length doesn't exceed (maxLength+threshold).java.util.List<java.lang.String>split(java.util.List<java.lang.String> input, java.lang.String prefix, java.lang.String delimiter, java.lang.String suffix, int minimumElements)Reverse function for join.java.util.List<java.lang.String>substring(java.util.List<java.lang.String> input, int beginIndex, int endIndex)Calculate substrings.java.util.List<java.lang.String>trim(java.util.List<java.lang.String> input)Trim whitespaces from start and end of all stringsjava.util.List<java.lang.String>truncate(java.util.List<java.lang.String> input, int maxLength, int threshold)Truncate strings to the given maximum length.java.util.List<java.lang.String>uppercase(java.util.List<java.lang.String> input)Turn all strings to uppercase
-
-
-
Field Detail
-
MAPPED_NAME
static final java.lang.String MAPPED_NAME
- See Also:
- Constant Field Values
-
NEWLINE
static final java.lang.CharSequence NEWLINE
-
-
Method Detail
-
base64decode
java.util.List<java.lang.String> base64decode(java.util.List<java.lang.String> input) throws PubServerExceptionBase64 decode all input strings. Chunked input will be detected and decoded also.- Parameters:
input- result from query or previous functions in the processing chain- Returns:
- the processed list
- Throws:
PubServerException
-
base64encode
java.util.List<java.lang.String> base64encode(java.util.List<java.lang.String> input, int chunkSize) throws PubServerExceptionBase64 encode all input strings- Parameters:
input- result from query or previous functions in the processing chainchunkSize- Chunk size. Negative values including zero means: no chunks.- Returns:
- the processed list
- Throws:
PubServerException
-
capitalize
java.util.List<java.lang.String> capitalize(java.util.List<java.lang.String> input) throws PubServerExceptionCapitalize strings, i.e.: convert all word starts to uppercase- Parameters:
input- result from query or previous functions in the processing chain- Returns:
- the processed list
- Throws:
PubServerException
-
htmlToPlainText
java.util.List<java.lang.String> htmlToPlainText(java.util.List<java.lang.String> input) throws PubServerExceptionConvert HTML to plain text, i.e.- replace all HTML breaks by new lines
- convert all numeric and named entities to their character equivalent
- strip all HTML tags
- strip all XML / HTML comments
- remove HTML declarations (e.g. <![CDATA...)
- Parameters:
input- result from query or previous functions in the processing chain- Returns:
- the processed list
- Throws:
PubServerException
-
inverseMatch
java.util.List<java.lang.String> inverseMatch(java.util.List<java.lang.String> input, java.lang.String pattern) throws PubServerExceptionReturn strings that do NOT match the given regular expression- Parameters:
input- result from query or previous functions in the processing chainpattern- inverse match strings against this regular expression- Returns:
- the processed list
- Throws:
PubServerException
-
join
java.util.List<java.lang.String> join(java.util.List<java.lang.String> input, java.lang.String prefix, java.lang.String delimiter, java.lang.String suffix, int minimumElements) throws PubServerExceptionJoin strings from input list and return a single string containing all strings concatenated according to these instructions:- insert prefix before the first string
- append delimiter to each string except the last one
- append suffix to the last string
- omit prefix and suffix if the input list contains less than minimum elements
- Parameters:
input- result from query or previous functions in the processing chainprefix- prefix for first stringdelimiter- delimiter for each string except the last onesuffix- suffix for last stringminimumElements- omit prefix and suffix, if input contains less than minimumElements elements. 0 means: always include prefix and suffix- Returns:
- the processed list
- Throws:
PubServerException
-
leftPad
java.util.List<java.lang.String> leftPad(java.util.List<java.lang.String> input, int maxLength, java.lang.String pad, boolean truncate) throws PubServerExceptionLeft pad a string up to a maximum length.- Parameters:
input- result from query or previous functions in the processing chainmaxLength- maximum lengthpad- pad character or string. Default is whitespace.truncate- truncate if input is longer. In this case, the string is truncated from LEFT- Returns:
- the processed list
- Throws:
PubServerException
-
leftTrim
java.util.List<java.lang.String> leftTrim(java.util.List<java.lang.String> input) throws PubServerExceptionTrim whitespaces from start of all strings- Parameters:
input- result from query or previous functions in the processing chain- Returns:
- the processed list
- Throws:
PubServerException
-
lowercase
java.util.List<java.lang.String> lowercase(java.util.List<java.lang.String> input) throws PubServerExceptionTurn all strings to lowercase- Parameters:
input- result from query or previous functions in the processing chain- Returns:
- the processed list
- Throws:
PubServerException
-
match
java.util.List<java.lang.String> match(java.util.List<java.lang.String> input, java.lang.String pattern) throws PubServerExceptionReturn strings that match the given regular expression- Parameters:
input- result from query or previous functions in the processing chainpattern- match strings against this regular expression- Returns:
- the processed list
- Throws:
PubServerException
-
md5
java.util.List<java.lang.String> md5(java.util.List<java.lang.String> input) throws PubServerExceptionCalculate and return the md5 checksum for each string.- Parameters:
input- result from query or previous functions in the processing chain- Returns:
- the processed list
- Throws:
PubServerException
-
replace
java.util.List<java.lang.String> replace(java.util.List<java.lang.String> input, java.lang.String search, java.lang.String replace) throws PubServerExceptionReplace all occurrences of String search by replace- Parameters:
input- result from query or previous functions in the processing chainsearch- search stringreplace- replace string- Returns:
- the processed list
- Throws:
PubServerException
-
replaceHtmlBreaks
java.util.List<java.lang.String> replaceHtmlBreaks(java.util.List<java.lang.String> input) throws PubServerExceptionReplace all HTML breaks by new lines- Parameters:
input- result from query or previous functions in the processing chain- Returns:
- the processed list of strings
- Throws:
PubServerException
-
replaceRegEx
java.util.List<java.lang.String> replaceRegEx(java.util.List<java.lang.String> input, java.lang.String searchPattern, java.lang.String replace) throws PubServerExceptionReplace all occurrences of regular expression searchPattern by replace- Parameters:
input- result from query or previous functions in the processing chainsearchPattern- regular expression for search stringreplace- replace string- Returns:
- the processed list
- Throws:
PubServerException
-
reverse
java.util.List<java.lang.String> reverse(java.util.List<java.lang.String> input) throws PubServerExceptionReverse strings- Parameters:
input- result from query or previous functions in the processing chain- Returns:
- the processed list
- Throws:
PubServerException
-
rightPad
java.util.List<java.lang.String> rightPad(java.util.List<java.lang.String> input, int maxLength, java.lang.String pad, boolean truncate) throws PubServerExceptionRight pad a string up to a maximum length.- Parameters:
input- result from query or previous functions in the processing chainmaxLength- maximum lengthpad- pad character or string. Default is whitespacetruncate- truncate if input is longer. In this case, the string is truncated from RIGHT- Returns:
- the processed list
- Throws:
PubServerException
-
rightTrim
java.util.List<java.lang.String> rightTrim(java.util.List<java.lang.String> input) throws PubServerExceptionTrim whitespaces from end of all strings- Parameters:
input- result from query or previous functions in the processing chain- Returns:
- the processed list
- Throws:
PubServerException
-
sanitize
java.util.List<java.lang.String> sanitize(java.util.List<java.lang.String> input) throws PubServerException"Sanitize" strings, i.e.:- remove double whitespaces
- remove all non-printable characters
- Parameters:
input- result from query or previous functions in the processing chain- Returns:
- the processed list
- Throws:
PubServerException
-
smartTruncate
java.util.List<java.lang.String> smartTruncate(java.util.List<java.lang.String> input, int maxLength, boolean wordSafe, int threshold) throws PubServerExceptionTruncate strings to the given maximum length.
If the string is longer, append three dots at the end, so that the result string including the dots has a maximum length of maxLength characters.
If wordSafe is set to true, also try to truncate at word ends - unless this would result in a string shorter then (maxLength - threshold), in this case ignore the wordSafe option.
Regardless of the wordSafe option, the entire string is returned, if it's length doesn't exceed (maxLength+threshold).- Parameters:
input- Result from query or previous functions in the processing chainmaxLength- maximum lengthwordSafe- regard words and try to truncate at word endsthreshold- threshold for truncation, -1 means no threshold- Returns:
- the processed list
- Throws:
PubServerException
-
split
java.util.List<java.lang.String> split(java.util.List<java.lang.String> input, java.lang.String prefix, java.lang.String delimiter, java.lang.String suffix, int minimumElements) throws PubServerExceptionReverse function for join. Split strings according to these instructions:- prefix to strip from the first string
- delimiter
- suffix to strip from the last string
- do not strip prefix and suffix if the result list contains less than minimum elements
- Parameters:
input- result from query or previous functions in the processing chainprefix- prefix to strip from the first stringdelimiter- delimitersuffix- suffix to strip from the last stringminimumElements- do not strip prefix and suffix, if the result list contains less than minimum elements. 0 means: always strip prefix and suffix.- Returns:
- the processed list
- Throws:
PubServerException
-
substring
java.util.List<java.lang.String> substring(java.util.List<java.lang.String> input, int beginIndex, int endIndex) throws PubServerExceptionCalculate substrings.- Parameters:
input- result from query or previous functions in the processing chainbeginIndex- begin indexendIndex- end index. -1 means: to end of input string- Returns:
- the processed list
- Throws:
PubServerException
-
trim
java.util.List<java.lang.String> trim(java.util.List<java.lang.String> input) throws PubServerExceptionTrim whitespaces from start and end of all strings- Parameters:
input- result from query or previous functions in the processing chain- Returns:
- the processed list
- Throws:
PubServerException
-
truncate
java.util.List<java.lang.String> truncate(java.util.List<java.lang.String> input, int maxLength, int threshold) throws PubServerExceptionTruncate strings to the given maximum length. If length of the input string doesn't exceed (maxLength + threshold) do not truncate.- Parameters:
input- result from query or previous functions in the processing chainmaxLength- maximum lengththreshold- threshold for truncation, -1 means no threshold- Returns:
- the processed list
- Throws:
PubServerException
-
uppercase
java.util.List<java.lang.String> uppercase(java.util.List<java.lang.String> input) throws PubServerExceptionTurn all strings to uppercase- Parameters:
input- result from query or previous functions in the processing chain- Returns:
- the processed list
- Throws:
PubServerException
-
formatPrice
java.util.List<java.lang.String> formatPrice(java.util.List<java.lang.String> input, java.lang.String decimalPlaceCharacter, java.lang.String formatString) throws PubServerExceptionFormat price with decimalPlaceCharacter and formatString using FormatUtils class.- Parameters:
input- result from query or previous functions in the processing chaindecimalPlaceCharacter- It is needed for parsing the rawPrice string to find the position of the decimal character.
It can only be the single character dot (.) or comma (,).formatString- Defines how the price will be formatted.
To identify the decimalPlace the strings before the decimal is formatted with '#', the string after as '0' (e.g.: #.###.###,000 or #.00).
Allowed #-patterns (here shown with a dot as thousands separator) are: #, #.##, #.###, #.##.##, #.###.###
Allowed decimal separator: ",", "."
Allowed thousands separator: ",", ".", "'"
At the beginning or the end of the formatString are all known currency symbols and currency short texts allowed also, separated with or without a blank.- Returns:
- the processed list
- Throws:
PubServerException
-
emptyStringIfNoResult
java.util.List<java.lang.String> emptyStringIfNoResult(java.util.List<java.lang.String> in)
Returns an empty string for each element in the input list, which is null or a single empty string, if the input list is null or empty.
Returns an empty string for each element in the input list, which is null or a single empty string, if the input list is null or empty.
Non empty and non null elements are added to the result list unchanged.- Parameters:
in- list of Strings from query or data mapping result- Returns:
- processed list as described above
-
defaultStringIfNoResult
java.util.List<java.lang.String> defaultStringIfNoResult(java.util.List<java.lang.String> in, java.lang.String defaultString)Returns a default string for each element in the input list, which is null resp. empty a single default string, if the input list is null or empty.
Returns a default string for each element in the input list, which is null resp. empty or a single default string, if the input list is null or empty.
Non empty and non null elements are added to the result list unchanged.- Parameters:
in- list of Strings from query or data mapping result- Returns:
- processed list as described above
-
-