public class StringUtils
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
EMPTY_STRING
An empty String.
Name of this parameter has been chosen carefully. |
| Modifier and Type | Method and Description |
|---|---|
static boolean |
hasLetters(java.lang.String text)
Returns an information about existence of (at least) one letter inside a text
|
static boolean |
isBlank(java.lang.String text) |
static boolean |
isEmpty(java.lang.CharSequence text) |
static boolean |
isNotBlank(java.lang.String text)
Method created after a special request of Lazar Stefanović.
He said that such a method would make his life much easier, so why shouldn't we make it? |
static boolean |
isNotEmpty(java.lang.String text)
Method created after a special request of Lazar Stefanović.
He said that such a method would make his life much easier, so why shouldn't we make it? |
static java.lang.String |
join(java.util.Collection<java.lang.Object> collection,
java.lang.String delimiter)
Joins collection of Strings into a single String.
|
static java.lang.String |
lowercase(java.lang.String text) |
static java.lang.String |
lowercaseFirst(java.lang.String text) |
static java.lang.String |
removeFormattingCharacters(java.lang.String text)
Removes formatting characters from a String
|
static java.lang.String |
removeSpaces(java.lang.String text)
Removes spaces (and only spaces) from a String.
It DOES NOT work like trim! It removes ALL the spaces from the text, even middle ones. |
static java.lang.String |
removeWhitespaces(java.lang.String text)
Removes whitespace-characters from a String
|
static java.lang.String |
replaceCharacter(java.lang.String text,
char characterOld,
char characterNew) |
static java.lang.String |
toAscii(java.lang.String text)
Converts all String letters to ascii
|
static java.lang.String |
toCamelNotation(java.lang.String text) |
static java.lang.String |
toCyrillic(java.lang.String text)
Converts all String letters to cyrillic
WARNING! This conversion is not unambiguous, and should be used "with disclaimer".
Examples of unwanted results : "Kralj Petar I Karađorđević" : "Краљ Петар И Карађорђевић" "Luj XIV" : "Луј ХИВ" "nadživeti" : "наџивети" |
static java.lang.String |
toLatin(java.lang.String text)
Converts all String letters to latin
|
static java.lang.String |
toPropertyName(java.lang.String text) |
static java.lang.String |
toSnakeNotation(java.lang.String text) |
static java.lang.String |
toSnakeNotationFromCamel(java.lang.String text) |
static java.lang.String |
uppercase(java.lang.String text) |
static java.lang.String |
uppercaseFirst(java.lang.String text) |
public static final java.lang.String EMPTY_STRING
null.public static boolean isEmpty(java.lang.CharSequence text)
text - An object whose "emptiness" should be evaluated. Could be null.true, if the CharSequence is empty or nullfalse, otherwise
isEmpty(null) = true
isEmpty("") = true
isEmpty(" ") = false
isEmpty("\t\n") = false
isEmpty("something") = false
public static boolean isBlank(java.lang.String text)
text - An object whose "blankness" should be evaluated. Could be null.true, if the CharSequence is empty, null or filled only with whitespace-charactersfalse, otherwise
isBlank(null) = true
isBlank("") = true
isBlank(" ") = true
isBlank("\t \n") = true
isBlank("something") = false
isBlank(" something ") = false
public static boolean isNotEmpty(java.lang.String text)
text - Text that should be testedtext is not emptypublic static boolean isNotBlank(java.lang.String text)
text - Text that should be testedtext is not blankpublic static java.lang.String removeSpaces(java.lang.String text)
trim! It removes ALL the spaces from the text, even middle ones.text - A text from which we should remove spaces.nullEMPTY_STRING, if original String is null.public static java.lang.String removeWhitespaces(java.lang.String text)
text - A text from which we should remove whitespace-characters.EMPTY_STRING, if original String is null.public static boolean hasLetters(java.lang.String text)
text - Text whose content we're inspectingpublic static java.lang.String removeFormattingCharacters(java.lang.String text)
text - A text from which we should remove formatting characters.EMPTY_STRING, if original String is null.public static java.lang.String toLatin(java.lang.String text)
text - Original textpublic static java.lang.String toAscii(java.lang.String text)
text - Original textpublic static java.lang.String toCyrillic(java.lang.String text)
text - Original textpublic static java.lang.String toPropertyName(java.lang.String text)
public static java.lang.String toCamelNotation(java.lang.String text)
public static java.lang.String uppercase(java.lang.String text)
public static java.lang.String toSnakeNotation(java.lang.String text)
public static java.lang.String toSnakeNotationFromCamel(java.lang.String text)
public static java.lang.String uppercaseFirst(java.lang.String text)
public static java.lang.String lowercaseFirst(java.lang.String text)
public static java.lang.String lowercase(java.lang.String text)
public static java.lang.String replaceCharacter(java.lang.String text,
char characterOld,
char characterNew)
public static java.lang.String join(java.util.Collection<java.lang.Object> collection,
java.lang.String delimiter)
Null-strings are skipped.collection - Collection of String that should be joineddelimiter - Delimiter that separates Strings. If null, then EMPTY_STRING is used as a delimiter.null-strings from a collection, delimited by given delimiter.