Interface StringFunctionsLocal


public interface StringFunctionsLocal
String methods for data processing
  • Field Details

  • Method Details

    • base64decode

      List<String> base64decode(List<String> input) throws PubServerException
      Base64 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

      List<String> base64encode(List<String> input, int chunkSize) throws PubServerException
      Base64 encode all input strings
      Parameters:
      input - result from query or previous functions in the processing chain
      chunkSize - Chunk size. Negative values including zero means: no chunks.
      Returns:
      the processed list
      Throws:
      PubServerException
    • capitalize

      List<String> capitalize(List<String> input) throws PubServerException
      Capitalize 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

      List<String> htmlToPlainText(List<String> input) throws PubServerException
      Convert 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

      List<String> inverseMatch(List<String> input, String pattern) throws PubServerException
      Return strings that do NOT match the given regular expression
      Parameters:
      input - result from query or previous functions in the processing chain
      pattern - inverse match strings against this regular expression
      Returns:
      the processed list
      Throws:
      PubServerException
    • join

      List<String> join(List<String> input, String prefix, String delimiter, String suffix, int minimumElements) throws PubServerException
      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 elements
      Parameters:
      input - result from query or previous functions in the processing chain
      prefix - prefix for first string
      delimiter - delimiter for each string except the last one
      suffix - suffix for last string
      minimumElements - 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

      List<String> leftPad(List<String> input, int maxLength, String pad, boolean truncate) throws PubServerException
      Left pad a string up to a maximum length.
      Parameters:
      input - result from query or previous functions in the processing chain
      maxLength - maximum length
      pad - 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

      List<String> leftTrim(List<String> input) throws PubServerException
      Trim 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

      List<String> lowercase(List<String> input) throws PubServerException
      Turn all strings to lowercase
      Parameters:
      input - result from query or previous functions in the processing chain
      Returns:
      the processed list
      Throws:
      PubServerException
    • match

      List<String> match(List<String> input, String pattern) throws PubServerException
      Return strings that match the given regular expression
      Parameters:
      input - result from query or previous functions in the processing chain
      pattern - match strings against this regular expression
      Returns:
      the processed list
      Throws:
      PubServerException
    • md5

      List<String> md5(List<String> input) throws PubServerException
      Calculate 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

      List<String> replace(List<String> input, String search, String replace) throws PubServerException
      Replace all occurrences of String search by replace
      Parameters:
      input - result from query or previous functions in the processing chain
      search - search string
      replace - replace string
      Returns:
      the processed list
      Throws:
      PubServerException
    • replaceHtmlBreaks

      List<String> replaceHtmlBreaks(List<String> input) throws PubServerException
      Replace 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

      List<String> replaceRegEx(List<String> input, String searchPattern, String replace) throws PubServerException
      Replace all occurrences of regular expression searchPattern by replace
      Parameters:
      input - result from query or previous functions in the processing chain
      searchPattern - regular expression for search string
      replace - replace string
      Returns:
      the processed list
      Throws:
      PubServerException
    • reverse

      List<String> reverse(List<String> input) throws PubServerException
      Reverse strings
      Parameters:
      input - result from query or previous functions in the processing chain
      Returns:
      the processed list
      Throws:
      PubServerException
    • rightPad

      List<String> rightPad(List<String> input, int maxLength, String pad, boolean truncate) throws PubServerException
      Right pad a string up to a maximum length.
      Parameters:
      input - result from query or previous functions in the processing chain
      maxLength - maximum length
      pad - pad character or string. Default is whitespace
      truncate - truncate if input is longer. In this case, the string is truncated from RIGHT
      Returns:
      the processed list
      Throws:
      PubServerException
    • rightTrim

      List<String> rightTrim(List<String> input) throws PubServerException
      Trim 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

      List<String> sanitize(List<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

      List<String> smartTruncate(List<String> input, int maxLength, boolean wordSafe, int threshold) throws PubServerException
      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).
      Parameters:
      input - Result from query or previous functions in the processing chain
      maxLength - maximum length
      wordSafe - regard words and try to truncate at word ends
      threshold - threshold for truncation, -1 means no threshold
      Returns:
      the processed list
      Throws:
      PubServerException
    • split

      List<String> split(List<String> input, String prefix, String delimiter, String suffix, int minimumElements) throws PubServerException
      Reverse 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 chain
      prefix - prefix to strip from the first string
      delimiter - delimiter
      suffix - suffix to strip from the last string
      minimumElements - 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

      List<String> substring(List<String> input, int beginIndex, int endIndex) throws PubServerException
      Calculate substrings.
      Parameters:
      input - result from query or previous functions in the processing chain
      beginIndex - begin index
      endIndex - end index. -1 means: to end of input string
      Returns:
      the processed list
      Throws:
      PubServerException
    • trim

      List<String> trim(List<String> input) throws PubServerException
      Trim 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

      List<String> truncate(List<String> input, int maxLength, int threshold) throws PubServerException
      Truncate 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 chain
      maxLength - maximum length
      threshold - threshold for truncation, -1 means no threshold
      Returns:
      the processed list
      Throws:
      PubServerException
    • uppercase

      List<String> uppercase(List<String> input) throws PubServerException
      Turn all strings to uppercase
      Parameters:
      input - result from query or previous functions in the processing chain
      Returns:
      the processed list
      Throws:
      PubServerException
    • formatPrice

      List<String> formatPrice(List<String> input, String decimalPlaceCharacter, String formatString) throws PubServerException
      Format price with decimalPlaceCharacter and formatString using FormatUtils class.
      Parameters:
      input - result from query or previous functions in the processing chain
      decimalPlaceCharacter - 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

      List<String> emptyStringIfNoResult(List<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

      List<String> defaultStringIfNoResult(List<String> in, 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