public final class StringUtil extends Object
| Modifier and Type | Field and Description |
|---|---|
static String[] |
STRING_ARRAY |
| Modifier and Type | Method and Description |
|---|---|
static String |
capatilizeFirstLetter(String str)
Capatilize only the first letter of the string.
|
static String |
capatilizeFirstLetterEachWord(String str)
Capatilize first letter of each word after a space, dot (.) or single-quote (').
|
static List<String> |
explode(String delimiter,
String str)
A method similar to PHP's explode() function (http://php.net/explode)
This method does not use RegularExpression based split as in Java.
|
static List<String> |
explodeFirst(String delimiter,
String str)
When delimiter is found in the string, the string is split into two parts:
sub-string till the delimiter, and the string after the delimiter.
|
static List<String> |
explodeLast(String delimiter,
String str)
Splits the string into two parts based on the last occurrence of the delimiter.
|
static String |
getNullStrIfNull(String str) |
static String |
implode(Collection<String> pieces)
A method similar to PHP's implode() function (http://php.net/implode)
|
static String |
implode(String[] pieces)
A method similar to PHP's implode() function (http://php.net/implode)
|
static String |
implode(String glue,
Collection<String> pieces)
A method similar to PHP's implode() function (http://php.net/implode)
|
static String |
implode(String glue,
String[] pieces)
A method similar to PHP's implode() function (http://php.net/implode)
|
static boolean |
isEmpty(String str)
Checks if the String is null, or an empty string.
|
static boolean |
isNotEmpty(String str)
Checks if the string is not null and not empty.
|
static String |
languageTrim(String str,
int length)
Trim text to the last whitespace character within range.
|
static String |
reverseCapitalization(String str)
Reverses the capitalization of the string.
|
public static final String[] STRING_ARRAY
public static boolean isEmpty(String str)
str - The string to check.public static boolean isNotEmpty(String str)
str - public static String getNullStrIfNull(String str)
str - The string to verify for null content.public static String implode(String glue, String[] pieces)
glue - The String to glue pieces together.pieces - An array of String which needs to be glued.public static String implode(String[] pieces)
pieces - An array of String which needs to be glued.public static String implode(String glue, Collection<String> pieces)
glue - The String to glue pieces together.pieces - A collection of String which needs to be glued.public static String implode(Collection<String> pieces)
pieces - A collection of String which needs to be glued.public static List<String> explode(String delimiter, String str)
delimiter - The delimiter string to split the string with.str - The input string.public static List<String> explodeFirst(String delimiter, String str)
delimiter - The delimiter string.str - The string to operate on.public static List<String> explodeLast(String delimiter, String str)
delimiter - The delimiter.str - The string to operate on.public static String capatilizeFirstLetter(String str)
str - The input string.public static String capatilizeFirstLetterEachWord(String str)
str - The input string.public static String reverseCapitalization(String str)
str - The string which needs to be converted.public static String languageTrim(String str, int length)
str - The input text that needs to be trimmed.length - The max-length to which it is trimmed to.Copyright © 2014. All rights reserved.