org.jtheque.utils
Class StringUtils

java.lang.Object
  extended by org.jtheque.utils.StringUtils

public final class StringUtils
extends Object

This class provides utilities function to manipulate String's object.

Author:
Baptiste Wicht

Field Summary
static String EMPTY_STRING
           
 
Method Summary
static String delete(String string, CharSequence toDelete)
           
static String delete(String string, Object... toDeletes)
           
static boolean endsWithOneOf(String value, String... ends)
          Test if the String value ends with one of the specified ends.
static boolean isEmpty(CharSequence string)
          Test if a string is empty or not.
static boolean isEmpty(String[] strings)
          Test if an array of String is empty.
static boolean isNotEmpty(CharSequence string)
          Return true if the string is not empty.
static boolean isNotEmpty(String[] strings)
          Test if an array of string is not empty.
static boolean isStringSurroundedWith(CharSequence str, char c)
          Indicate if the string is surrounded by the character c.
static String removeHTMLEntities(String htmlString)
          Remove the HTML entities of a string.
static void removeLastSpace(StringBuilder builder)
          Remove the last space in the StringBuilder.
static String removeNumbers(CharSequence value)
          Remove all numbers of the given string.
static String removeSurroundedChars(String str)
          Remove the first and the test chars.
static String removeUnicode(String value)
          Remove the unicode characters from a string.
static String setFirstLetterOnlyUpper(String word)
          Set the first letter of the String to upper.
static String setFirstLetterUpper(String word)
          Set the first letter of the String to upper.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EMPTY_STRING

public static final String EMPTY_STRING
See Also:
Constant Field Values
Method Detail

setFirstLetterOnlyUpper

public static String setFirstLetterOnlyUpper(String word)
Set the first letter of the String to upper. All the others chars will be lower case.

Parameters:
word - The string to modify.
Returns:
The modified string.

setFirstLetterUpper

public static String setFirstLetterUpper(String word)
Set the first letter of the String to upper.

Parameters:
word - The string to modify.
Returns:
The modified string.

isEmpty

public static boolean isEmpty(CharSequence string)
Test if a string is empty or not.

Parameters:
string - The string to test.
Returns:
true if the string is empty else false.

isNotEmpty

public static boolean isNotEmpty(CharSequence string)
Return true if the string is not empty.

Parameters:
string - The string to test.
Returns:
true if the string is not empty else false.

removeLastSpace

public static void removeLastSpace(StringBuilder builder)
Remove the last space in the StringBuilder.

Parameters:
builder - The builder we must modify

removeHTMLEntities

public static String removeHTMLEntities(String htmlString)
Remove the HTML entities of a string.

Parameters:
htmlString - The string to clear.
Returns:
The cleared string.

isStringSurroundedWith

public static boolean isStringSurroundedWith(CharSequence str,
                                             char c)
Indicate if the string is surrounded by the character c.

Parameters:
str - The string to test.
c - The char to test.
Returns:
true if the string is surrounded by c else false.

removeSurroundedChars

public static String removeSurroundedChars(String str)
Remove the first and the test chars.

Parameters:
str - The string to edit.
Returns:
The string without his surrounded chars.

removeUnicode

public static String removeUnicode(String value)
Remove the unicode characters from a string.

Parameters:
value - The string to clean.
Returns:
The cleaned string.

endsWithOneOf

public static boolean endsWithOneOf(String value,
                                    String... ends)
Test if the String value ends with one of the specified ends.

Parameters:
value - The String value to test.
ends - The possible ends.
Returns:
true if the String value ends with one of the specified ends.

isEmpty

public static boolean isEmpty(String[] strings)
Test if an array of String is empty. An array of strings is empty if one of these rule matches :

Parameters:
strings - The array to test.
Returns:
true if the array is empty else false.

isNotEmpty

public static boolean isNotEmpty(String[] strings)
Test if an array of string is not empty.

Parameters:
strings - The array of Strings to test.
Returns:
true if the array is not empty else false.
See Also:
isEmpty(String[] strings);

removeNumbers

public static String removeNumbers(CharSequence value)
Remove all numbers of the given string.

Parameters:
value - The string.
Returns:
The given string without any numbers.

delete

public static String delete(String string,
                            Object... toDeletes)

delete

public static String delete(String string,
                            CharSequence toDelete)


Copyright © 2010 JTheque. All Rights Reserved.