Class StringUtil


  • public class StringUtil
    extends java.lang.Object
    • Constructor Summary

      Constructors 
      Constructor Description
      StringUtil()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.StringBuffer join​(java.lang.String glue, java.lang.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.
      static java.lang.StringBuffer join​(java.lang.String glue, java.lang.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.
      static <E> java.lang.StringBuffer join​(java.lang.String glue, java.util.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.
      static java.util.List<java.lang.String> tokenizeToList​(java.lang.String s, char separator)
      Split up a string into tokens delimited by the specified separator character.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • StringUtil

        public StringUtil()
    • Method Detail

      • tokenizeToList

        public static java.util.List<java.lang.String> tokenizeToList​(java.lang.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 java.lang.StringBuffer join​(java.lang.String glue,
                                                  java.lang.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 java.lang.StringBuffer join​(java.lang.String glue,
                                                  java.lang.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> java.lang.StringBuffer join​(java.lang.String glue,
                                                      java.util.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