(This is a cut-down version of the same class in ph-commons-util.)
| Modifier and Type | Field and Description |
|---|---|
| public static final String[] | EMPTY_STRING_ARRAY
Shared instance of an empty array of Strings, which is sometimes useful! |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public static String | Returns: same string if it is non-empty, otherwise null.Convenience method that turns a String to an empty String ("") if it is null. |
| public static boolean | fromBinaryValues(final String value, final String
value returning true trueValue, final String value returning false falseValue)Converts the given String argument to a boolean using the scheme trueValue => true, falseValue => false. |
| public static boolean | Returns: true if "yes", false if "no"Converts the given String argument to a boolean using the scheme "true"=>true, "false"=>false. |
| public static boolean | |
| public static boolean | |
| public static String | Returns: objects joined using the given separator.collection of Objects to join objects, final CharSequence separator to use separator)Joins the given collection of Objects using the given separator and each Object's normal toString() method. |
| public static String | join(final Object[]
array of Objects to join objects, final CharSequence separator to use separator)Same as |
| public static void | join(final StringBuilder
StringBuilder to append results to resultBuilder, final Object[] array of Objects to join objects, final CharSequence separator to use separator)Version of |
| public static String | join(final Object[]
array of Objects to join objects, final CharSequence separator to use separator, final int first index to join startIndex, final int index after last one to join endIndex)Version of |
| public static void | join(final StringBuilder
StringBuilder to append results to resultBuilder, final Object[] array of Objects to join objects, final CharSequence separator to use separator, final int first index to join startIndex, final int index after last one to join endIndex)Version of |
| public static String | Returns: same string if it is non-null and non-empty, otherwise null.Convenience method that turns a String to null if it is empty (i.e. "") or null. |
| public static String | Returns: "true" if true, "false" if false.boolean to convert state)Trivial helper method to convert a boolean into either "true" or "false" depending on its state. |
| public static String | Returns: "yes" if true, "no" if false.boolean to convert state)Trivial helper method to convert a boolean into either "yes" or "no" depending on its state. |
| EMPTY_STRING_ARRAY | back to summary |
|---|---|
| public static final String[] EMPTY_STRING_ARRAY Shared instance of an empty array of Strings, which is sometimes useful! | |
| StringUtilities | back to summary |
|---|---|
| public StringUtilities() | |
| emptyIfNull | back to summary |
|---|---|
| public static String emptyIfNull(final String string) Convenience method that turns a String to an empty String ("") if it is null.
| |
| fromBinaryValues | back to summary |
|---|---|
| public static boolean fromBinaryValues(final String value, final String trueValue, final String falseValue) Converts the given String argument to a boolean using the scheme trueValue => true, falseValue => false. Any other value results in an IllegalArgumentException.
| |
| fromTrueFalse | back to summary |
|---|---|
| public static boolean fromTrueFalse(final String value) Converts the given String argument to a boolean using the scheme "true"=>true, "false"=>false. Any other value results in an IllegalArgumentException.
| |
| fromYesNo | back to summary |
|---|---|
| public static boolean fromYesNo(final String value) Converts the given String argument to a boolean using the scheme "yes"=>true, "no"=>false. Any other value results in an IllegalArgumentException.
| |
| isNullOrEmpty | back to summary |
|---|---|
| public static boolean isNullOrEmpty(final String string) Tests whether the given String is null or empty (""). | |
| join | back to summary |
|---|---|
| public static String join(final Iterable<? extends Object> objects, final CharSequence separator) Joins the given collection of Objects using the given separator and each Object's normal toString() method. For example, joining the collection "a", "b", "c" with "/" gives "a/b/c".
| |
| join | back to summary |
|---|---|
| public static String join(final Object[] objects, final CharSequence separator) Same as
| |
| join | back to summary |
|---|---|
| public static void join(final StringBuilder resultBuilder, final Object[] objects, final CharSequence separator) Version of
| |
| join | back to summary |
|---|---|
| public static String join(final Object[] objects, final CharSequence separator, final int startIndex, final int endIndex) Version of
| |
| join | back to summary |
|---|---|
| public static void join(final StringBuilder resultBuilder, final Object[] objects, final CharSequence separator, final int startIndex, final int endIndex) Version of
| |
| nullIfEmpty | back to summary |
|---|---|
| public static String nullIfEmpty(final String string) Convenience method that turns a String to null if it is empty (i.e. "") or null.
| |
| toTrueFalse | back to summary |
|---|---|
| public static String toTrueFalse(final boolean state) Trivial helper method to convert a boolean into either "true" or "false" depending on its state.
| |
| toYesNo | back to summary |
|---|---|
| public static String toYesNo(final boolean state) Trivial helper method to convert a boolean into either "yes" or "no" depending on its state.
| |