public class StringUtils
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static @NotNull java.util.regex.Pattern |
PATTERN_BACKSLASH
The pattern that matches a single backslash ("\").
|
static @NotNull java.util.regex.Pattern |
PATTERN_COLON
The pattern that matches a single colon (":").
|
static @NotNull java.util.regex.Pattern |
PATTERN_COMMA
The pattern that matches a single comma (",").
|
static @NotNull java.util.regex.Pattern |
PATTERN_END_OF_LINE
The pattern to match end of line characters separating lines.
|
static @NotNull java.util.regex.Pattern |
PATTERN_EQUAL
The pattern that matches a single equal sign ("=").
|
static @NotNull java.util.regex.Pattern |
PATTERN_NEWLINE
The pattern that matches a single newline ("\n").
|
static @NotNull java.util.regex.Pattern |
PATTERN_SLASH
The pattern that matches a single slash ("/").
|
static @NotNull java.util.regex.Pattern |
PATTERN_SPACE
The pattern that matches a single space.
|
static @NotNull java.util.regex.Pattern |
PATTERN_SPACES
The pattern that matches a non-empty sequence of spaces.
|
static @NotNull java.util.regex.Pattern |
PATTERN_WHITESPACE
Pattern to match whitespace excluding NL and CR.
|
static @NotNull java.util.regex.Pattern |
PATTERN_WHITESPACE_NEWLINE
Pattern to match whitespace including NL and CR.
|
Modifier and Type | Method and Description |
---|---|
static @Nullable java.lang.CharSequence |
diffTextString(@NotNull java.lang.CharSequence base,
@NotNull java.lang.String str,
boolean ignoreValues)
Helper function for 'diffArchText()': Looks for occurrence of the
attribute 'str' in 'base' and if found, returns the full line where 'str'
occurs in base.
|
static @NotNull java.lang.CharSequence |
ensureTrailingNewline(@NotNull java.lang.String str)
Returns a given string which ends with a trailing newline character;
empty strings remain empty.
|
static @Nullable java.lang.String |
getAttribute(@NotNull java.lang.CharSequence attributes,
@NotNull java.lang.String attributeName)
Returns an attribute line from a set of attribute definitions.
|
static @NotNull java.lang.String |
removeTrailingWhitespace(@NotNull java.lang.CharSequence str)
Removes trailing whitespace from a string.
|
static @NotNull java.lang.String |
removeTrailingWhitespaceFromLines(@NotNull java.lang.CharSequence str)
Removes trailing whitespace from all lines of a string.
|
static @NotNull java.lang.String |
sortLines(@NotNull java.lang.CharSequence string)
Sorts newline separated lines in a string.
|
@NotNull public static final @NotNull java.util.regex.Pattern PATTERN_WHITESPACE
@NotNull public static final @NotNull java.util.regex.Pattern PATTERN_WHITESPACE_NEWLINE
@NotNull public static final @NotNull java.util.regex.Pattern PATTERN_END_OF_LINE
@NotNull public static final @NotNull java.util.regex.Pattern PATTERN_SPACE
@NotNull public static final @NotNull java.util.regex.Pattern PATTERN_SPACES
@NotNull public static final @NotNull java.util.regex.Pattern PATTERN_SLASH
@NotNull public static final @NotNull java.util.regex.Pattern PATTERN_BACKSLASH
@NotNull public static final @NotNull java.util.regex.Pattern PATTERN_COLON
@NotNull public static final @NotNull java.util.regex.Pattern PATTERN_COMMA
@NotNull public static final @NotNull java.util.regex.Pattern PATTERN_EQUAL
@NotNull public static final @NotNull java.util.regex.Pattern PATTERN_NEWLINE
@NotNull public static @NotNull java.lang.String removeTrailingWhitespace(@NotNull @NotNull java.lang.CharSequence str)
str
- the string@NotNull public static @NotNull java.lang.String removeTrailingWhitespaceFromLines(@NotNull @NotNull java.lang.CharSequence str)
str
- the string@NotNull public static @NotNull java.lang.CharSequence ensureTrailingNewline(@NotNull @NotNull java.lang.String str)
str
- the input string@Nullable public static @Nullable java.lang.CharSequence diffTextString(@NotNull @NotNull java.lang.CharSequence base, @NotNull @NotNull java.lang.String str, boolean ignoreValues)
base
- full text to searchstr
- string (attribute) to look forignoreValues
- if true, lines are matched against 'str' only till
the first space (" ")@Nullable public static @Nullable java.lang.String getAttribute(@NotNull @NotNull java.lang.CharSequence attributes, @NotNull @NotNull java.lang.String attributeName)
attributeName
, only the first
instance is returned.attributes
- the attribute set to searchattributeName
- the attribute name to search fornull
if the attribute was
not found@NotNull public static @NotNull java.lang.String sortLines(@NotNull @NotNull java.lang.CharSequence string)
string
- the string to sort