org.semwebcentral.sweetrules.util
Class SweetStringUtil

java.lang.Object
  extended byorg.semwebcentral.sweetrules.util.SweetStringUtil

public class SweetStringUtil
extends java.lang.Object

This is a utility class for String handling

Author:
Shashidhara K Ganjugunte, Dr. Benjamin Grosof, Dr. Said Tabet, Chitravanu Neogy

Constructor Summary
SweetStringUtil()
           
 
Method Summary
static boolean compareStringArray(java.lang.String[] array1, java.lang.String[] array2, boolean ignoreCase, boolean ignoreWhiteSpace)
          A utility method to compare 2 string arrays
static boolean isZeroLengthString(java.lang.String inputString)
          A utility function that returns true if either the string is null or of 0 length
static java.lang.String trimIfNotNull(java.lang.String str)
          Checks to see if the given string is null, if it is not trims it
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SweetStringUtil

public SweetStringUtil()
Method Detail

compareStringArray

public static final boolean compareStringArray(java.lang.String[] array1,
                                               java.lang.String[] array2,
                                               boolean ignoreCase,
                                               boolean ignoreWhiteSpace)
A utility method to compare 2 string arrays

Parameters:
array1 - The first array
array2 - The second array
ignoreCase - if true will ignore case while comparison
ignoreWhiteSpace - if true will ignore white space while comparison
Returns:
If two arrays have the same strings then true is returned otherwise false

isZeroLengthString

public static boolean isZeroLengthString(java.lang.String inputString)
A utility function that returns true if either the string is null or of 0 length

Parameters:
inputString - The string to be checked
Returns:
true if the String is of 0 length

trimIfNotNull

public static java.lang.String trimIfNotNull(java.lang.String str)
Checks to see if the given string is null, if it is not trims it

Parameters:
str - The string to be trimmed
Returns:
The trimmed string