public class ManStringExt
extends java.lang.Object
| Constructor and Description |
|---|
ManStringExt() |
| Modifier and Type | Method and Description |
|---|---|
static java.lang.String |
emptyIfNull(java.lang.String thiz)
Returns the string if it is not null, or the empty string otherwise.
|
static java.lang.String |
padEnd(java.lang.String thiz,
int length,
char padChar)
Pads the string to the specified
length at the end with the specified character or space. |
static java.lang.String |
padStart(java.lang.String thiz,
int length,
char padChar)
Pads the string to the specified
length at the beginning with the specified character or space. |
static java.lang.String |
removePrefix(java.lang.String thiz,
java.lang.CharSequence prefix)
If thiz string starts with the given
prefix, returns a copy of thiz string
with the prefix removed. |
static java.lang.String |
removeSuffix(java.lang.String thiz,
java.lang.CharSequence suffix)
If thiz string ends with the given
suffix, returns a copy of thiz string
with the suffix removed. |
static java.lang.CharSequence |
removeSurrounding(java.lang.String thiz,
java.lang.CharSequence delimiter)
Removes the given
delimiter string from both the start and the end of thiz string
if and only if it starts with and ends with the delimiter. |
static java.lang.String |
removeSurrounding(java.lang.String thiz,
java.lang.CharSequence prefix,
java.lang.CharSequence suffix)
Removes from a string both the given
prefix and suffix if and only if
it starts with the prefix and ends with the suffix. |
static java.lang.String |
substringAfter(java.lang.String thiz,
char delimiter)
Returns a substring after the first occurrence of
delimiter or null if the string
does not contain the delimiter |
static java.lang.String |
substringAfter(java.lang.String thiz,
java.lang.String delimiter)
Returns a substring after the first occurrence of
delimiter or null if the string
does not contain the delimiter |
static java.lang.String |
substringAfterLast(java.lang.String thiz,
char delimiter)
Returns a substring after the last occurrence of delimiter or null if the string
does not contain the delimiter
|
static java.lang.String |
substringAfterLast(java.lang.String thiz,
java.lang.String delimiter)
Returns a substring after the last occurrence of delimiter or null if the string
does not contain the delimiter
|
static java.lang.String |
substringBefore(java.lang.String thiz,
char delimiter)
Returns a substring before the first occurrence of
delimiter or null if the string
does not contain the delimiter |
static java.lang.String |
substringBefore(java.lang.String thiz,
java.lang.String delimiter)
Returns a substring before the first occurrence of
delimiter or null if the string
does not contain the delimiter |
static java.lang.String |
substringBeforeLast(java.lang.String thiz,
char delimiter)
Returns a substring before the last occurrence of
delimiter or null if the string
does not contain the delimiter |
static java.lang.String |
substringBeforeLast(java.lang.String thiz,
java.lang.String delimiter)
Returns a substring before the last occurrence of
delimiter or null if the string
does not contain the delimiter |
static java.lang.String |
trim(java.lang.String thiz,
char... chars)
Returns a string with leading and trailing characters from the
chars array trimmed. |
static java.lang.String |
trim(java.lang.String thiz,
CharPredicate predicate)
Returns a string with leading and trailing characters matching the
predicate trimmed. |
static java.lang.String |
trimEnd(java.lang.String thiz)
Returns a string with trailing whitespace removed.
|
static java.lang.String |
trimEnd(java.lang.String thiz,
char... chars)
Returns a string with trailing characters from the
chars array trimmed. |
static java.lang.String |
trimEnd(java.lang.String thiz,
CharPredicate predicate)
Returns a string with trailing characters matching the
predicate trimmed. |
static java.lang.String |
trimStart(java.lang.String thiz)
Returns a string with leading whitespace removed.
|
static java.lang.String |
trimStart(java.lang.String thiz,
char... chars)
Returns a string with leading and trailing characters from the
chars array trimmed. |
static java.lang.String |
trimStart(java.lang.String thiz,
CharPredicate predicate)
Returns a string with leading characters matching the
predicate trimmed. |
public static java.lang.String trim(java.lang.String thiz,
CharPredicate predicate)
predicate trimmed.public static java.lang.String trimStart(java.lang.String thiz,
CharPredicate predicate)
predicate trimmed.public static java.lang.String trimEnd(java.lang.String thiz,
CharPredicate predicate)
predicate trimmed.public static java.lang.String trim(java.lang.String thiz,
char... chars)
chars array trimmed.public static java.lang.String trimStart(java.lang.String thiz,
char... chars)
chars array trimmed.public static java.lang.String trimEnd(java.lang.String thiz,
char... chars)
chars array trimmed.public static java.lang.String trimStart(java.lang.String thiz)
public static java.lang.String trimEnd(java.lang.String thiz)
public static java.lang.String padStart(java.lang.String thiz,
int length,
char padChar)
length at the beginning with the specified character or space.length - the desired string length.padChar - the character to pad string with, if it has length less than the length specified.length, consisting of string prepended with padChar as many times.
as are necessary to reach that length.public static java.lang.String padEnd(java.lang.String thiz,
int length,
char padChar)
length at the end with the specified character or space.length - the desired string length.padChar - the character to pad string with, if it has length less than the length specified.length, consisting of string prepended with padChar as many times.
as are necessary to reach that length.public static java.lang.String emptyIfNull(java.lang.String thiz)
public static java.lang.String substringBefore(java.lang.String thiz,
char delimiter)
delimiter or null if the string
does not contain the delimiterpublic static java.lang.String substringBefore(java.lang.String thiz,
java.lang.String delimiter)
delimiter or null if the string
does not contain the delimiterpublic static java.lang.String substringAfter(java.lang.String thiz,
char delimiter)
delimiter or null if the string
does not contain the delimiterpublic static java.lang.String substringAfter(java.lang.String thiz,
java.lang.String delimiter)
delimiter or null if the string
does not contain the delimiterpublic static java.lang.String substringBeforeLast(java.lang.String thiz,
char delimiter)
delimiter or null if the string
does not contain the delimiterpublic static java.lang.String substringBeforeLast(java.lang.String thiz,
java.lang.String delimiter)
delimiter or null if the string
does not contain the delimiterpublic static java.lang.String substringAfterLast(java.lang.String thiz,
char delimiter)
public static java.lang.String substringAfterLast(java.lang.String thiz,
java.lang.String delimiter)
public static java.lang.String removePrefix(java.lang.String thiz,
java.lang.CharSequence prefix)
prefix, returns a copy of thiz string
with the prefix removed. Otherwise, returns thiz string.public static java.lang.String removeSuffix(java.lang.String thiz,
java.lang.CharSequence suffix)
suffix, returns a copy of thiz string
with the suffix removed. Otherwise, returns thiz string.public static java.lang.String removeSurrounding(java.lang.String thiz,
java.lang.CharSequence prefix,
java.lang.CharSequence suffix)
prefix and suffix if and only if
it starts with the prefix and ends with the suffix.
Otherwise returns thiz string unchanged.public static java.lang.CharSequence removeSurrounding(java.lang.String thiz,
java.lang.CharSequence delimiter)
delimiter string from both the start and the end of thiz string
if and only if it starts with and ends with the delimiter.
Otherwise returns thiz string unchanged.Copyright © 2023. All rights reserved.