org.makumba.commons
Class StringUtils

java.lang.Object
  extended by org.makumba.commons.StringUtils

public class StringUtils
extends Object

This class provides utility methods for String manipulation.

Version:
$Id: StringUtils.java 5153 2010-05-18 21:37:50Z rosso_nero $
Author:
Rudolf Mayer

Constructor Summary
StringUtils()
           
 
Method Summary
static boolean allNotEmpty(String[] o)
           
static boolean anyNotEmpty(String[] o)
           
static String[] append(String[] functionNames, String toAppend)
           
static String concatAsString(Collection<?> collection)
           
static String concatAsString(Collection<?> collection, String delim)
           
static String concatAsString(Object[] array)
           
static String concatAsString(Object[] array, String delim)
           
static boolean endsWith(String s, String[] options)
          Checks whether the given String ends with any of the given options.
static boolean equals(Object o, String s)
          Checks whether the given Object equals the given String.
static boolean equals(String s, Object o)
          Checks whether the given Object equals the given String.
static boolean equalsAny(Object o, String... options)
          Checks whether the given Object equals any of the given options.
static boolean equalsAny(String s, String... options)
          Checks whether the given String equals any of the given options.
static String getAbsolutePath(String requestURI, String page)
           
static String getExceptionStackTrace(Exception e)
           
static String getParam(String paramName, String queryString)
          Fetches a param out of a typical param string found in HTML tags
static String getStartsWith(String s, String[] options)
           
static boolean isEmpty(Object o)
          Checks whether an Object is null or has, after trimming, a length == 0.
static String lowerCaseBeginning(String s)
          Returns a string with lower-cased first letter.
static boolean notEmpty(Object o)
          Checks whether a String is not null and has, after trimming, a length > 0.
static String removeRedundantSpaces(String s)
           
static String removeSingleQuote(String s)
          Removes single quotes, if the string is starting and ending with the single quote character.
static String reverseString(String s)
           
static boolean startsWith(String s, String[] options)
          Checks whether the given String starts with any of the given options.
static int toInt(String str, int defaultValue)
          Convert a String to an int, returning a default value if the conversion fails or if the string is null.
static String toString(Collection<?> collection)
           
static String toString(Collection<?> collection, boolean frame)
           
static String toString(Collection<?> collection, boolean frame, String delimeter)
           
static String toString(Enumeration<?> enumeration)
           
static String toString(Object[] array)
          Converts an array to a String represenation, using the toString() method of each array element.
static String toString(Object[] array, boolean frame)
           
static String toString(Object[] array, boolean frame, String delimeter)
           
static String toString(Object[] array, String delimeter)
           
static String upperCaseBeginning(String s)
          Returns a string with upper-cased first letter.
 
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

lowerCaseBeginning

public static String lowerCaseBeginning(String s)
Returns a string with lower-cased first letter.


upperCaseBeginning

public static String upperCaseBeginning(String s)
Returns a string with upper-cased first letter.


notEmpty

public static boolean notEmpty(Object o)
Checks whether a String is not null and has, after trimming, a length > 0.


anyNotEmpty

public static boolean anyNotEmpty(String[] o)

allNotEmpty

public static boolean allNotEmpty(String[] o)

isEmpty

public static boolean isEmpty(Object o)
Checks whether an Object is null or has, after trimming, a length == 0.


toString

public static String toString(Object[] array)
Converts an array to a String represenation, using the toString() method of each array element.


toString

public static String toString(Object[] array,
                              String delimeter)

toString

public static String toString(Object[] array,
                              boolean frame)

toString

public static String toString(Object[] array,
                              boolean frame,
                              String delimeter)

toString

public static String toString(Collection<?> collection,
                              boolean frame,
                              String delimeter)

toString

public static String toString(Collection<?> collection,
                              boolean frame)

toString

public static String toString(Collection<?> collection)

concatAsString

public static String concatAsString(Collection<?> collection)

concatAsString

public static String concatAsString(Collection<?> collection,
                                    String delim)

concatAsString

public static String concatAsString(Object[] array)

concatAsString

public static String concatAsString(Object[] array,
                                    String delim)

equals

public static boolean equals(String s,
                             Object o)
Checks whether the given Object equals the given String.


equals

public static boolean equals(Object o,
                             String s)
Checks whether the given Object equals the given String.


equalsAny

public static boolean equalsAny(Object o,
                                String... options)
Checks whether the given Object equals any of the given options.


equalsAny

public static boolean equalsAny(String s,
                                String... options)
Checks whether the given String equals any of the given options.


startsWith

public static boolean startsWith(String s,
                                 String[] options)
Checks whether the given String starts with any of the given options.


getStartsWith

public static String getStartsWith(String s,
                                   String[] options)

endsWith

public static boolean endsWith(String s,
                               String[] options)
Checks whether the given String ends with any of the given options.


toInt

public static int toInt(String str,
                        int defaultValue)
Convert a String to an int, returning a default value if the conversion fails or if the string is null.


toString

public static String toString(Enumeration<?> enumeration)

append

public static String[] append(String[] functionNames,
                              String toAppend)

getParam

public static String getParam(String paramName,
                              String queryString)
Fetches a param out of a typical param string found in HTML tags

Parameters:
paramName - the name of the param
queryString - the string to search within
Returns:
the value of the param if found, null otherwise

getAbsolutePath

public static String getAbsolutePath(String requestURI,
                                     String page)

reverseString

public static String reverseString(String s)

getExceptionStackTrace

public static String getExceptionStackTrace(Exception e)

removeRedundantSpaces

public static String removeRedundantSpaces(String s)

removeSingleQuote

public static String removeSingleQuote(String s)
Removes single quotes, if the string is starting and ending with the single quote character.