public final class StringUtil
extends java.lang.Object
| Modifier and Type | Field and Description | 
|---|---|
static char[] | 
ADDITIONAL_ALLOWED_FILE_NAME_SYSTEM_CHARACTERS
Additional characters allowed in file systems. 
 | 
static java.lang.String | 
EMPTY_STRING
Constant for an empty string. 
 | 
static java.lang.String | 
LATIN_ALPHABET_BIG
The latin alphabet with big capitals. 
 | 
static java.lang.String | 
LATIN_ALPHABET_SMALL
The latin alphabet with small capitals. 
 | 
static java.lang.String | 
NEW_LINE
Constant for a line break. 
 | 
static java.lang.String | 
NUMERALS
The numerals. 
 | 
static java.lang.String | 
WHITESPACE
All characters representing whitespace. 
 | 
| Modifier | Constructor and Description | 
|---|---|
private  | 
StringUtil()
Forbid instances by this private constructor. 
 | 
| Modifier and Type | Method and Description | 
|---|---|
static java.lang.String | 
chop(java.lang.String text,
    int maxLength)
Chops the given text if required. 
 | 
static boolean | 
contains(java.lang.String string,
        java.lang.CharSequence substring)
 Checks if the given string contains the substring. 
 | 
static java.util.Comparator<java.lang.String> | 
createIgnoreCaseComparator()
Creates a  
Comparator that can be used to compute the
 equality of two given Strings ignoring the case
 via String.compareToIgnoreCase(String). | 
static java.lang.String | 
createLine(java.lang.String text,
          int repetitions)
Creates a line which consists of the given text. 
 | 
static boolean | 
equalIgnoreWhiteSpace(java.lang.String first,
                     java.lang.String second)
Checks the equality of the given  
Strings ignoring whitespace. | 
static java.lang.String | 
fillString(java.lang.String text,
          char leadingCharacter,
          int length)
Fills the given text with the leading character until it has the defined length. 
 | 
static boolean | 
isEmpty(java.lang.String text)
Checks if the  
String is empty. | 
static boolean | 
isNumber(java.lang.String val)  | 
static boolean | 
isTrimmedEmpty(java.lang.String text)
Checks if the trimmed  
String is empty. | 
static java.lang.String | 
replaceAll(java.lang.String text,
          char[] toSearch,
          char toReplace)
Replaces all occurrences of a search sign with the replacement sign. 
 | 
static boolean | 
startsWith(java.lang.Object obj,
          java.lang.String prefix)
Checks if the given  
Object is a String which starts with the given prefix. | 
static java.lang.String | 
toLowerCase(java.lang.String text)
Nullpointer save execution of  
String.toLowerCase(). | 
static java.lang.String | 
toSingleLinedString(java.lang.String text)
Converts the optional multi lined  
String in a single lined String
 by replacing all line breaks and tabs with a space. | 
static java.lang.String | 
trim(java.lang.String text)
Nullpointer save execution of  
String.trim() | 
static java.lang.String | 
trimRight(java.lang.String text)
Performs a trim only on the right side. 
 | 
public static final java.lang.String EMPTY_STRING
public static final java.lang.String NEW_LINE
public static final java.lang.String LATIN_ALPHABET_BIG
public static final java.lang.String LATIN_ALPHABET_SMALL
public static final char[] ADDITIONAL_ALLOWED_FILE_NAME_SYSTEM_CHARACTERS
 It is important that ':' is not contained because "::" is replaced with a '/' by the JFileChooser under Mac OS.
public static final java.lang.String NUMERALS
public static final java.lang.String WHITESPACE
public static boolean isEmpty(java.lang.String text)
String is empty.text - The text to check.true = text is null or empty, false = text is not empty.public static boolean isTrimmedEmpty(java.lang.String text)
String is empty.text - The text to check.true = text is null or trimmed empty, false = text is not empty.public static java.lang.String trim(java.lang.String text)
String.trim()text - The text.public static java.lang.String toLowerCase(java.lang.String text)
String.toLowerCase().text - The text to convert.null if the given text is null.public static java.util.Comparator<java.lang.String> createIgnoreCaseComparator()
Comparator that can be used to compute the
 equality of two given Strings ignoring the case
 via String.compareToIgnoreCase(String). If both values
 are null also 0 is returned in 
 Comparator.compare(Object, Object). If only one value
 is null Comparator.compare(Object, Object) will
 return a value different to 0.Comparator.public static java.lang.String createLine(java.lang.String text,
                                          int repetitions)
text - The text to repeate.repetitions - The number of repetitions.public static boolean contains(java.lang.String string,
                               java.lang.CharSequence substring)
Checks if the given string contains the substring.
Attention: The empty string is contained in every string.
string - The string that should contain the substring.substring - The substring to check.true strings are not null and the string contains the substring, false if at least one string is null or the string does not contain the substring.public static java.lang.String toSingleLinedString(java.lang.String text)
String in a single lined String
 by replacing all line breaks and tabs with a space.text - The text to convert.public static java.lang.String replaceAll(java.lang.String text,
                                          char[] toSearch,
                                          char toReplace)
text - The text to search and replace in.toSearch - The signs to search.toReplace - The sign to replace with.String.public static boolean equalIgnoreWhiteSpace(java.lang.String first,
                                            java.lang.String second)
Strings ignoring whitespace.first - The first String.second - The second String.true equal ignoring whitespace, false different.public static java.lang.String fillString(java.lang.String text,
                                          char leadingCharacter,
                                          int length)
                                   throws java.lang.IllegalArgumentException
text - The text to fill.leadingCharacter - The leading character to use.length - The length to fill up to.java.lang.IllegalArgumentException - If the text is already longer as the given lengthpublic static java.lang.String trimRight(java.lang.String text)
text - The text to trim its right side.public static java.lang.String chop(java.lang.String text,
                                    int maxLength)
text - The text to check.maxLength - The maximal length to ensure.public static boolean startsWith(java.lang.Object obj,
                                 java.lang.String prefix)
Object is a String which starts with the given prefix.obj - The Object to check.prefix - The prefix to check for.true Object is String with given prefix, false otherwise.public static boolean isNumber(java.lang.String val)