org.ujac.util
Class StringUtils

java.lang.Object
  extended by org.ujac.util.StringUtils

public class StringUtils
extends Object

Name: StringUtils
Description: Class providing common utility methods for String operations.

Author:
lauerc

Constructor Summary
StringUtils()
           
 
Method Summary
static String capitalize(String text)
          Raises the first character of the given String.
static boolean equals(String a, String b)
          Checks if the given objects are equal.
static boolean equals(String a, String b, boolean caseSensitive)
          Checks if the given objects are equal.
static int getLength(String text)
          Gets the length of the given String.
static String getLowerCase(String text)
          Gets the lower case String from the given String.
static String getUpperCase(String text)
          Gets the upper case String from the given String.
static boolean isEmpty(String value)
          Checks if the given string is null or has zero length.
static boolean like(String a, String b)
          Checks if the given objects are likewise.
static boolean like(String a, String b, boolean caseSensitive)
          Checks if the given objects are likewise.
static String trim(String string)
          Trims off the heading and trailing white spaces from the given string.
static String trimHead(String string)
          Trims off the heading white spaces from the given string.
static String trimTail(String string)
          Trims off the trailing white spaces from the content buffer.
 
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

isEmpty

public static final boolean isEmpty(String value)
Checks if the given string is null or has zero length.

Parameters:
value - The string to check.
Returns:
true if the given string is null or has zero length.

getLength

public static final int getLength(String text)
Gets the length of the given String.

Parameters:
text - The String to get the length from.
Returns:
The length of the given String.

getUpperCase

public static final String getUpperCase(String text)
Gets the upper case String from the given String.

Parameters:
text - The String to get the upper case String from.
Returns:
The upper case string of the given String or null.

getLowerCase

public static final String getLowerCase(String text)
Gets the lower case String from the given String.

Parameters:
text - The String to get the lower case String from.
Returns:
The lower case string of the given String or null.

capitalize

public static final String capitalize(String text)
Raises the first character of the given String.

Parameters:
text - The String to capitalize.
Returns:
The capitalized String or null.

equals

public static final boolean equals(String a,
                                   String b)
Checks if the given objects are equal.

Parameters:
a - The object to compare with object b.
b - The object to compare with object a.
Returns:
true if the objects are equal or are both null.

equals

public static final boolean equals(String a,
                                   String b,
                                   boolean caseSensitive)
Checks if the given objects are equal.

Parameters:
a - The object to compare with object b.
b - The object to compare with object a.
caseSensitive - Tells whether or not to compare string values case sensitive.
Returns:
true if the objects are equal or are both null.

like

public static final boolean like(String a,
                                 String b)
Checks if the given objects are likewise.

Parameters:
a - The object to compare with object b.
b - The object to compare with object a.
Returns:
true if a is like b or are both null.

like

public static final boolean like(String a,
                                 String b,
                                 boolean caseSensitive)
Checks if the given objects are likewise.

Parameters:
a - The object to compare with object b.
b - The object to compare with object a.
caseSensitive - Tells whether or not to compare string values case sensitive.
Returns:
true if a is like b or are both null.

trim

public static final String trim(String string)
Trims off the heading and trailing white spaces from the given string.

Parameters:
string - the string to trim.
Returns:
The trimmed string.

trimHead

public static final String trimHead(String string)
Trims off the heading white spaces from the given string.

Parameters:
string - the string to trim.
Returns:
The trimmed string.

trimTail

public static final String trimTail(String string)
Trims off the trailing white spaces from the content buffer.

Parameters:
string - the string to trim.
Returns:
The trimmed string.


Copyright © 2003-2004 UJAC.org. All Rights Reserved.