Class StringUtils


  • public final class StringUtils
    extends java.lang.Object
    String utilities method
    Version:
    $Id: StringUtils.java,v 1.3 2004/09/19 20:07:32 thlee Exp $ $Name: $
    Author:
    TiongHiang Lee (thlee@onemindsoft.org)
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private StringUtils()
      Constructor
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String concat​(java.lang.Object[] objects, java.lang.String delimiter)
      Concant the object in the array (using objects.toString()), delimited by delimiter
      static java.lang.String concat​(java.util.Collection l, java.lang.String delimiter)
      Concat the collection l to string with delimenter
      static boolean isNullOrEmpty​(java.lang.Object strObject)
      Whether the string is empty
      static boolean isNullOrEmpty​(java.lang.String str)
      Whether the string is empty
      static java.lang.String substringAfter​(java.lang.String str, java.lang.String pattern)
      Return the substring after the first occurrance of pattern
      static java.lang.String substringAfterLast​(java.lang.String str, java.lang.String pattern)
      Return substring of str after the the last occurrance of pattern
      static java.lang.String substringBeforeLast​(java.lang.String str, java.lang.String pattern)
      Return substring of str before the last occurrance of str
      • Methods inherited from class java.lang.Object

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

      • StringUtils

        private StringUtils()
        Constructor
    • Method Detail

      • concat

        public static java.lang.String concat​(java.util.Collection l,
                                              java.lang.String delimiter)
        Concat the collection l to string with delimenter
        Parameters:
        l - the collection
        delimiter - the delimiter
        Returns:
        the result string
      • concat

        public static java.lang.String concat​(java.lang.Object[] objects,
                                              java.lang.String delimiter)
        Concant the object in the array (using objects.toString()), delimited by delimiter
        Parameters:
        objects - the objects
        delimiter - the delimiter
        Returns:
        a string
      • substringAfter

        public static java.lang.String substringAfter​(java.lang.String str,
                                                      java.lang.String pattern)
        Return the substring after the first occurrance of pattern
        Parameters:
        str - the str
        pattern - the pattern
        Returns:
        the substring of pattern can be matched in str, or null
      • substringAfterLast

        public static java.lang.String substringAfterLast​(java.lang.String str,
                                                          java.lang.String pattern)
        Return substring of str after the the last occurrance of pattern
        Parameters:
        str - the str
        pattern - the pattern
        Returns:
        the substring if pattern can be matched in the str, or null
      • substringBeforeLast

        public static java.lang.String substringBeforeLast​(java.lang.String str,
                                                           java.lang.String pattern)
        Return substring of str before the last occurrance of str
        Parameters:
        str - the str
        pattern - the pattern
        Returns:
        the substring if pattern can be matched, or null
      • isNullOrEmpty

        public static boolean isNullOrEmpty​(java.lang.String str)
        Whether the string is empty
        Parameters:
        str - whether is null or zero length (after trim)
        Returns:
        true if null of zero length after trim
      • isNullOrEmpty

        public static boolean isNullOrEmpty​(java.lang.Object strObject)
        Whether the string is empty
        Parameters:
        str - whether is null or zero length (after trim)
        Returns:
        true if null of zero length after trim