Class StringUtils


  • public class StringUtils
    extends java.lang.Object
    A helper class for various string operations
    • Constructor Summary

      Constructors 
      Constructor Description
      StringUtils()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String[] split​(java.lang.String str, char separator)
      we can't use String.split as it is a JDK 1.4 method.
      static java.lang.String[] split​(java.lang.String str, java.lang.String separator)
      split using a string separator
      static java.lang.String stripStart​(java.lang.String str, java.lang.String stripChars)
      Strips any of a set of characters from the start of a String.
      • Methods inherited from class java.lang.Object

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

      • StringUtils

        public StringUtils()
    • Method Detail

      • split

        public static java.lang.String[] split​(java.lang.String str,
                                               char separator)
        we can't use String.split as it is a JDK 1.4 method. //TODO Java 1.4 is not aproblem anymore. Isn't it ?
        Parameters:
        str -
        separator -
        Returns:
        an array of string segments
      • split

        public static java.lang.String[] split​(java.lang.String str,
                                               java.lang.String separator)
        split using a string separator
        Parameters:
        str -
        separator -
        Returns:
        an array of string segments
      • stripStart

        public static java.lang.String stripStart​(java.lang.String str,
                                                  java.lang.String stripChars)

        Strips any of a set of characters from the start of a String.

        A null input String returns null. An empty string ("") input returns the empty string.

        If the stripChars String is null, whitespace is stripped as defined by Character.isWhitespace(char).

         StringUtils.stripStart(null, *)          = null
         StringUtils.stripStart("", *)            = ""
         StringUtils.stripStart("abc", "")        = "abc"
         StringUtils.stripStart("abc", null)      = "abc"
         StringUtils.stripStart("  abc", null)    = "abc"
         StringUtils.stripStart("abc  ", null)    = "abc  "
         StringUtils.stripStart(" abc ", null)    = "abc "
         StringUtils.stripStart("yxabc  ", "xyz") = "abc  "
         
        Parameters:
        str - the String to remove characters from, may be null
        stripChars - the characters to remove, null treated as whitespace
        Returns:
        the stripped String, null if null String input