Class StringUtil


  • public class StringUtil
    extends Object
    • Constructor Detail

      • StringUtil

        public StringUtil()
    • Method Detail

      • tokenizeToList

        public static List<String> tokenizeToList​(String s,
                                                  char separator)
        Split up a string into tokens delimited by the specified separator character. If the string is null or zero length, returns null.
        Parameters:
        s - The String to tokenize
        separator - The character delimiting tokens
        Returns:
        A List of String tokens, or null is s is null or 0 length.
      • join

        public static StringBuffer join​(String glue,
                                        String[] strings)
        Takes a string 'glue' and array of strings, and returns a StringBuffer containing the strings joined with the glue between each of them. The strings are joined in order *
        Parameters:
        glue - The glue string
        strings - The strings to join
        Returns:
        a StringBuffer
      • join

        public static StringBuffer join​(String glue,
                                        String[] strings,
                                        int first,
                                        int last)
        Takes a string 'glue' and array of strings, and returns a StringBuffer containing the strings between the specified indices (inclusive) joined with the glue between each of them. The strings are joined in order
        Parameters:
        glue - The glue string
        strings - The strings to join
        first - The index of the first string to join
        last - The index of the last string to join
        Returns:
        a StringBuffer
      • join

        public static <E> StringBuffer join​(String glue,
                                            Collection<E> charSequences)
        Takes a string 'glue' and collection of CharSequences, and returns a StringBuffer containing the CharSequences joined with the glue between each of them. They are joined in the order returned by the iterator of the colection
        Parameters:
        glue - The glue string
        charSequences - The CharSequences to join
        Returns:
        a StringBuffer