Package org.onemind.commons.java.util
Class StringUtils
- java.lang.Object
-
- org.onemind.commons.java.util.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 delimiterstatic java.lang.String
concat(java.util.Collection l, java.lang.String delimiter)
Concat the collection l to string with delimenterstatic boolean
isNullOrEmpty(java.lang.Object strObject)
Whether the string is emptystatic boolean
isNullOrEmpty(java.lang.String str)
Whether the string is emptystatic java.lang.String
substringAfter(java.lang.String str, java.lang.String pattern)
Return the substring after the first occurrance of patternstatic java.lang.String
substringAfterLast(java.lang.String str, java.lang.String pattern)
Return substring of str after the the last occurrance of patternstatic java.lang.String
substringBeforeLast(java.lang.String str, java.lang.String pattern)
Return substring of str before the last occurrance of str
-
-
-
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 collectiondelimiter
- 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 objectsdelimiter
- 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 strpattern
- 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 strpattern
- 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 strpattern
- 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
-
-