|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjlibs.core.lang.StringUtil
public class StringUtil
| Constructor Summary | |
|---|---|
StringUtil()
|
|
| Method Summary | ||
|---|---|---|
static String |
capitalize(String str)
Converts first character in str to uppercase. |
|
static boolean |
equalsIgnoreCase(String s1,
String s2)
|
|
static String |
fromLiteral(String str)
|
|
static String[] |
getTokens(String str,
String delim,
boolean trim)
Splits given string into tokens with delimiters specified. |
|
static boolean |
isEmpty(CharSequence str)
returns true if str is null or
its length is zero |
|
static boolean |
isWhitespace(CharSequence str)
returns true if str is null or
it contains only whitespaces. |
|
static
|
join(Iterator<T> iter)
|
|
static
|
join(Iterator<T> iter,
String separator)
|
|
static
|
join(Iterator<T> iter,
String separator,
Convertor<T,String> convertor)
|
|
static
|
join(T[] array)
|
|
static
|
join(T[] array,
String separator)
|
|
static
|
join(T[] array,
String separator,
Convertor<T,String> convertor)
|
|
static String |
ordinalize(int number)
Turns a non-negative number into an ordinal string used to denote the position in an ordered sequence, such as 1st, 2nd, 3rd, 4th |
|
static String |
suggest(Filter<String> filter,
String pattern,
boolean tryEmptyVar)
the pattern specified must have variable part ${i} example: test${i}.txt it will find a string using pattern, which is accepted by the specified filter. |
|
static int[] |
toCodePoints(String str)
|
|
static String |
toLiteral(char ch,
boolean useRaw)
|
|
static String |
toLiteral(CharSequence str,
boolean useRaw)
|
|
static String |
toString(Object obj)
if obj is null, returns empty string. |
|
static String |
underscore(String camelCaseWord)
Makes an underscored form from the expression in the string. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public StringUtil()
| Method Detail |
|---|
public static boolean equalsIgnoreCase(String s1,
String s2)
public static String toString(Object obj)
obj is null, returns empty string.
otherwise returns obj.toString()
public static boolean isEmpty(CharSequence str)
str is null or
its length is zero
public static boolean isWhitespace(CharSequence str)
str is null or
it contains only whitespaces.
Character.isWhitespace(char) is used
to test for whitespace
public static String[] getTokens(String str,
String delim,
boolean trim)
str - string to be tokenizeddelim - delimiters used for tokenizingtrim - trim the tokens
public static String suggest(Filter<String> filter,
String pattern,
boolean tryEmptyVar)
FileUtil.findFreeFile(java.io.File dir, String pattern, boolean tryEmptyVar)public static String capitalize(String str)
str to uppercase.
This method can be called on string of any length.
str - string to be converted
public static String underscore(String camelCaseWord)
Examples:
underscore("activeRecord") // "active_record"
underscore("ActiveRecord") // "active_record"
underscore("firstName") // "first_name"
underscore("FirstName") // "first_name"
underscore("name") // "name"
camelCaseWord - the camel-cased word that is to be converted;
public static String ordinalize(int number)
number - the non-negative number
public static int[] toCodePoints(String str)
public static <T> String join(T[] array)
public static <T> String join(T[] array,
String separator)
public static <T> String join(T[] array,
String separator,
Convertor<T,String> convertor)
public static <T> String join(Iterator<T> iter)
public static <T> String join(Iterator<T> iter,
String separator)
public static <T> String join(Iterator<T> iter,
String separator,
Convertor<T,String> convertor)
public static String toLiteral(char ch,
boolean useRaw)
public static String toLiteral(CharSequence str,
boolean useRaw)
public static String fromLiteral(String str)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||