com.taursys.util
Class StringUtil

java.lang.Object
  extended bycom.taursys.util.StringUtil

public class StringUtil
extends java.lang.Object

Various utility string methods.


Constructor Summary
StringUtil()
           
 
Method Summary
static java.lang.String arrayToString(java.lang.Object[] array)
          Returns a String with all the toString values(comma separated) from the given array.
static java.lang.String baseClassName(java.lang.String clsName)
          Returns the base class name without the package name for the given class name.
static java.lang.String classVarName(java.lang.String clsName)
          Returns a class variable name based on the given class name.
static boolean contains(java.lang.String searchString, java.lang.String targetString)
          Returns true if the given searchString is found in the targetString.
static boolean differ(java.lang.String x, java.lang.String y)
          Utility method to compare two strings (either of which can be null) and indicate if they differ.
static java.lang.String identityString(java.lang.Object obj)
          Returns an identity string for the given object for diagnostics.
static java.lang.String nullIfBlank(java.lang.String s)
          Returns null if given String is blank or empty(length=0) else returns given String.
static java.lang.String packageName(java.lang.String clsName)
          Returns the package name for the given class name.
static java.lang.String[] stringToArray(java.lang.String s)
          Takes a string of comma separated names and returns as an array of strings.
static java.lang.String[] stringToArray(java.lang.String s, int extraSpace)
          Returns an String array from the given String of comma separated names.
 
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

differ

public static boolean differ(java.lang.String x,
                             java.lang.String y)
Utility method to compare two strings (either of which can be null) and indicate if they differ. It can include null strings in the comparison. It returns true if both strings are null or both strings match.


nullIfBlank

public static java.lang.String nullIfBlank(java.lang.String s)
Returns null if given String is blank or empty(length=0) else returns given String.


baseClassName

public static java.lang.String baseClassName(java.lang.String clsName)
Returns the base class name without the package name for the given class name.


packageName

public static java.lang.String packageName(java.lang.String clsName)
Returns the package name for the given class name.


classVarName

public static java.lang.String classVarName(java.lang.String clsName)
Returns a class variable name based on the given class name.


arrayToString

public static java.lang.String arrayToString(java.lang.Object[] array)
Returns a String with all the toString values(comma separated) from the given array.


stringToArray

public static java.lang.String[] stringToArray(java.lang.String s,
                                               int extraSpace)
Returns an String array from the given String of comma separated names. The size of the returned array is the number of items in the given String plus the indicated number of extra space.


stringToArray

public static java.lang.String[] stringToArray(java.lang.String s)
Takes a string of comma separated names and returns as an array of strings.


contains

public static boolean contains(java.lang.String searchString,
                               java.lang.String targetString)
Returns true if the given searchString is found in the targetString.


identityString

public static java.lang.String identityString(java.lang.Object obj)
Returns an identity string for the given object for diagnostics. The string is composed of the class name and a hexidecimal representation of its hash code. If the object is null, "null" is returned.

Parameters:
obj - the object to return the identity string for
Returns:
an identity string for the given object


Copyright © 2007 Martin T Phelan. All Rights Reserved.