String or CharSequence instances.
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public static String | commonPrefix(CharSequence a, CharSequence b)
Returns the longest string |
| public static String | commonSuffix(CharSequence a, CharSequence b)
Returns the longest string |
| public static String | Returns: string itself if it is nonempty; null if it is empty or nullthe string to test and possibly return string)Returns the given string if it is nonempty; |
| public static boolean | Returns: true if the string is null or is the empty stringa string reference to check string)Returns |
| public static String | lenientFormat(String
a string containing zero or more template, @Nullable Object... "%s" placeholder sequences. null is treated as the four-character string "null".the arguments to be substituted into the message template. The first argument
specified is substituted for the first occurrence of args)"%s" in the template, and so
forth. A null argument is converted to the four-character string "null";
non-null values are converted to strings using Object#toString().Returns the given |
| private static String | |
| public static String | Returns: string itself if it is non-null; "" if it is nullthe string to test and possibly return string)Returns the given string if it is non-null; the empty string otherwise. |
| public static String | Returns: the padded stringthe string which should appear at the beginning of the result string, int the minimum length the resulting string must have. Can be zero or negative, in
which case the input string is always returned. minLength, char the character to append to the end of the result until the minimum length is
reached padChar)Returns a string, of length at least |
| public static String | Returns: the padded stringthe string which should appear at the end of the result string, int the minimum length the resulting string must have. Can be zero or negative, in
which case the input string is always returned. minLength, char the character to insert at the beginning of the result until the minimum length
is reached padChar)Returns a string, of length at least |
| public static String | |
| pack-priv static boolean | validSurrogatePairAt(CharSequence string, int index)
True when a valid surrogate pair starts at the given |
| Strings | back to summary |
|---|---|
| private Strings() | |
| commonPrefix | back to summary |
|---|---|
| public static String commonPrefix(CharSequence a, CharSequence b) Returns the longest string
| |
| commonSuffix | back to summary |
|---|---|
| public static String commonSuffix(CharSequence a, CharSequence b) Returns the longest string
| |
| emptyToNull | back to summary |
|---|---|
| public static String emptyToNull(String string) Returns the given string if it is nonempty; | |
| isNullOrEmpty | back to summary |
|---|---|
| public static boolean isNullOrEmpty(String string) Returns Consider normalizing your string references with
| |
| lenientFormat | back to summary |
|---|---|
| public static String lenientFormat(String template, @Nullable Object... args) Returns the given Note For most string-formatting needs, use In certain cases, such as outputting debugging information or constructing a message to be
used for another unchecked exception, an exception during string formatting would serve little
purpose except to supplant the real information you were trying to provide. These are the cases
this method is made for; it instead generates a best-effort string with all supplied argument
values present. This method is also useful in environments such as GWT where Warning Only the exact two-character placeholder sequence
| |
| lenientToString | back to summary |
|---|---|
| private static String lenientToString(Object o) | |
| nullToEmpty | back to summary |
|---|---|
| public static String nullToEmpty(String string) Returns the given string if it is non-null; the empty string otherwise. | |
| padEnd | back to summary |
|---|---|
| public static String padEnd(String string, int minLength, char padChar) Returns a string, of length at least
See
| |
| padStart | back to summary |
|---|---|
| public static String padStart(String string, int minLength, char padChar) Returns a string, of length at least
See
| |
| repeat | back to summary |
|---|---|
| public static String repeat(String string, int count) Returns a string consisting of a specific number of concatenated copies of an input string. For
example, Java 11+ users: use
| |
| validSurrogatePairAt | back to summary |
|---|---|
| pack-priv static boolean validSurrogatePairAt(CharSequence string, int index) True when a valid surrogate pair starts at the given
| |