Class StringUtil


  • public class StringUtil
    extends Object
    Helper class called between Lists of Strings and Arrays of Strings.
    Author:
    Suneet Shah
    • Constructor Detail

      • StringUtil

        public StringUtil()
    • Method Detail

      • fromBase64

        public static String fromBase64​(String encoded)
        Parameters:
        encoded - Base64 encoded String to be decoded
        Returns:
        Decoded string, or null if input was null or decoding failed
      • toBase64

        public static String toBase64​(String plain)
        Parameters:
        plain - String to be Base64 encoded
        Returns:
        Base64 encoded String, or null if input was null or encoding failed
      • attachAndTruncate

        public static String attachAndTruncate​(int maxSize,
                                               String main,
                                               String suffix)
                                        throws IllegalArgumentException
        attach and truncate main part if concantinated string more than maxSize
        Parameters:
        maxSize - - maxSize of total string
        main - - main part, chars will be truncated from this string
        suffix - - suffix is immutable.
        Returns:
        - contantinated string with length not more than maxSize
        Throws:
        IllegalArgumentException