public final class Strings
extends java.lang.Object
Library of tools for working with strings.
Modifier and Type | Class and Description |
---|---|
static class |
Strings.NextInfo |
Modifier and Type | Field and Description |
---|---|
static int |
BY_COLUMNS |
static int |
BY_ROWS |
static int |
CANON_EQ |
static int |
CASE_INSENSITIVE |
static int |
COMMENTS |
static int |
DOTALL |
static int |
HTML_AUTO_SIZE |
static int |
HTML_TAG |
static int |
MULTILINE |
static int |
UNICODE_CASE |
static int |
UNIX_LINES
Returns s if any string is null, or s is "", or oldSubstring is ""
|
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
addLFIfNotEmpty(java.lang.String s) |
static java.lang.String |
afterLastSubstring(java.lang.String s,
java.lang.String sub) |
static java.lang.String |
appendSeparator(java.lang.String s,
java.lang.String separator) |
static java.lang.String |
beforeLastSubstring(java.lang.String s,
java.lang.String sub) |
static boolean |
between(int a,
char[] bounds) |
static boolean |
between(int a,
int b,
int c) |
static char |
charAt(java.lang.String s,
int off) |
static int |
charCount(java.lang.String s,
char c) |
static java.lang.String |
chomp(java.lang.String s)
Removes ending '\n' character or "\r\n" character pair;
also converts null to "".
|
static java.lang.String |
chop(java.lang.String s) |
static java.lang.String |
ctrlsToJava(java.lang.String s) |
static java.lang.String |
ctrlsToXml(java.lang.String s) |
static java.lang.String |
ctrlsToXml(java.lang.String s,
boolean encodeForAttributes) |
static java.lang.String |
ctrlsToXml(java.lang.String s,
boolean encodeForAttributes,
boolean replaceLowCtrlsToSpace) |
static char[] |
decodeUnicodeEscapes(char[] s) |
static char[] |
decodeUnicodeEscapes(char[] s,
boolean justDeleteFirstUInSequenceOfSeveralU) |
static char[] |
decodeUnicodeEscapes(char[] s,
int off,
int len) |
static char[] |
decodeUnicodeEscapes(char[] s,
int off,
int len,
boolean justDeleteFirstUInSequenceOfSeveralU) |
static java.lang.String |
decodeUnicodeEscapes(java.lang.String s) |
static java.lang.String |
decodeUnicodeEscapes(java.lang.String s,
boolean justDeleteFirstUInSequenceOfSeveralU) |
static char[] |
decodeUnicodeEscapesSingle(char[] s) |
static char[] |
decodeUnicodeEscapesSingle(char[] s,
int off,
int len) |
static java.lang.String |
decodeUnicodeEscapesSingle(java.lang.String s) |
static java.lang.String |
dup(char c,
int len) |
static java.lang.String |
dup(java.lang.String s,
int n) |
static char[] |
encodeUnicodeEscapesSingle(char[] s) |
static char[] |
encodeUnicodeEscapesSingle(char[] s,
int off,
int len) |
static java.lang.String |
encodeUnicodeEscapesSingle(java.lang.String s) |
static java.lang.String |
endSubstringIgnoringQuotedStart(java.lang.String s,
int start) |
static boolean |
find(java.lang.String s,
java.lang.String regex) |
static boolean |
find(java.lang.String s,
java.lang.String regex,
int flags) |
static Strings.NextInfo |
findNextQuote(char[] s,
int start) |
static Strings.NextInfo |
findNextQuote(char[] s,
int start,
char quote) |
static Strings.NextInfo |
findNextQuote(java.lang.String s,
int start) |
static Strings.NextInfo |
findNextQuote(java.lang.String s,
int start,
char quote) |
static Strings.NextInfo |
findSubstringIgnoringQuotedStart(java.lang.String s,
java.lang.String match) |
static Strings.NextInfo |
findSubstringIgnoringQuotedStart(java.lang.String s,
java.lang.String match,
int start) |
static java.lang.String |
htmlPreformat(java.lang.String html,
boolean enableWordWrap) |
static java.lang.String |
htmlPreformat(java.lang.String ascii,
int tabLen,
boolean enableWordWrap,
boolean addMonospaceFontTag,
boolean addHtmlTag) |
static java.lang.String |
htmlTable(java.lang.Object[][] cellValues) |
static java.lang.String |
htmlTable(java.lang.Object[][] cellValues,
int flags) |
static java.lang.String |
htmlTable(java.lang.Object[][] cellValues,
java.lang.String tableAttributes) |
static java.lang.String |
htmlTable(java.lang.Object[][] cellValues,
java.lang.String tableAttributes,
int flags) |
static java.lang.String |
htmlTable(java.lang.Object[][] cellValues,
java.lang.String tableAttributes,
java.lang.String[] tdAttributes) |
static java.lang.String |
htmlTable(java.lang.Object[][] cellValues,
java.lang.String tableAttributes,
java.lang.String[] tdAttributes,
int flags) |
static int |
indexOf(java.lang.String s,
char[] bounds) |
static int |
indexOf(java.lang.String s,
char c1,
char c2) |
static int |
indexOf(java.lang.String s,
int fromIndex,
char[] bounds) |
static int |
indexOf(java.lang.String s,
int fromIndex,
char c1,
char c2) |
static java.lang.String |
javaNameToTagName(java.lang.String name) |
static java.lang.String |
javaNameToWords(java.lang.String name,
java.lang.String separator) |
static java.lang.String |
javaToCtrls(java.lang.String s) |
static int |
lastIndexOf(java.lang.String s,
char[] bounds) |
static int |
lastIndexOf(java.lang.String s,
char c1,
char c2) |
static int |
lastIndexOf(java.lang.String s,
int fromIndex,
char[] bounds) |
static int |
lastIndexOf(java.lang.String s,
int fromIndex,
char c1,
char c2) |
static java.lang.String |
leftPad(java.lang.String s,
int len) |
static java.lang.String |
leftPad(java.lang.String s,
int len,
char pad) |
static java.lang.String |
leftTrim(java.lang.String s) |
static java.lang.String |
normalizeLF(java.lang.String s) |
static java.lang.String |
normalizeLF(java.lang.String s,
java.lang.String newLineSeparator) |
static java.lang.String |
replaceAll(java.lang.String s,
java.lang.String regex,
java.lang.String replacement,
int flags) |
static java.lang.String |
rightPad(java.lang.String s,
int len) |
static java.lang.String |
rightPad(java.lang.String s,
int len,
char pad) |
static java.lang.String |
rightTrim(java.lang.String s) |
static java.lang.String[] |
split(java.lang.String s) |
static java.lang.String[] |
split(java.lang.String s,
java.lang.String separators) |
static java.util.List |
splitAsList(java.lang.String s,
java.lang.String separators) |
static java.lang.String[] |
splitStringWithQuotes(java.lang.String s,
char separator) |
static void |
splitStringWithQuotes(java.lang.String s,
char separator,
java.util.List resultStrings) |
static java.lang.String |
substr(java.lang.String s,
int beginIndex,
int len) |
static java.lang.String |
substring(java.lang.String s,
int beginIndex) |
static java.lang.String |
substring(java.lang.String s,
int beginIndex,
int endIndex) |
static java.lang.String |
toIgnoreCase(java.lang.String s) |
static java.lang.String |
untilLastSubstring(java.lang.String s,
java.lang.String sub) |
static java.lang.String |
xmlAttr(java.lang.String attrName,
java.lang.String value) |
static java.lang.String |
xmlTag(java.lang.String tagName,
java.lang.String text) |
static java.lang.String |
xmlTag(java.lang.String tagName,
java.lang.String text,
boolean doEncodeText) |
static java.lang.String |
xmlToCtrls(java.lang.String s) |
static java.lang.String |
xmlToCtrls(java.lang.String s,
int start,
int end) |
static java.lang.StringBuffer |
xmlToCtrls(java.lang.String s,
int start,
int end,
java.lang.StringBuffer sb) |
static java.lang.StringBuffer |
xmlToCtrls(java.lang.String s,
java.lang.StringBuffer sb) |
public static final int UNIX_LINES
public static final int CASE_INSENSITIVE
public static final int COMMENTS
public static final int MULTILINE
public static final int DOTALL
public static final int UNICODE_CASE
public static final int CANON_EQ
public static final int BY_ROWS
public static final int BY_COLUMNS
public static final int HTML_TAG
public static final int HTML_AUTO_SIZE
public static boolean between(int a, int b, int c)
public static boolean between(int a, char[] bounds)
public static java.lang.String substring(java.lang.String s, int beginIndex, int endIndex)
public static java.lang.String substr(java.lang.String s, int beginIndex, int len)
public static java.lang.String substring(java.lang.String s, int beginIndex)
public static char charAt(java.lang.String s, int off)
public static boolean find(java.lang.String s, java.lang.String regex)
public static boolean find(java.lang.String s, java.lang.String regex, int flags)
public static java.lang.String replaceAll(java.lang.String s, java.lang.String regex, java.lang.String replacement, int flags)
public static int indexOf(java.lang.String s, char c1, char c2)
public static int indexOf(java.lang.String s, int fromIndex, char c1, char c2)
public static int indexOf(java.lang.String s, char[] bounds)
public static int indexOf(java.lang.String s, int fromIndex, char[] bounds)
public static int lastIndexOf(java.lang.String s, char c1, char c2)
public static int lastIndexOf(java.lang.String s, int fromIndex, char c1, char c2)
public static int lastIndexOf(java.lang.String s, char[] bounds)
public static int lastIndexOf(java.lang.String s, int fromIndex, char[] bounds)
public static java.lang.String toIgnoreCase(java.lang.String s)
public static java.lang.String untilLastSubstring(java.lang.String s, java.lang.String sub)
public static java.lang.String beforeLastSubstring(java.lang.String s, java.lang.String sub)
public static java.lang.String afterLastSubstring(java.lang.String s, java.lang.String sub)
public static java.lang.String dup(char c, int len)
public static java.lang.String dup(java.lang.String s, int n)
public static java.lang.String leftPad(java.lang.String s, int len)
public static java.lang.String rightPad(java.lang.String s, int len)
public static java.lang.String leftPad(java.lang.String s, int len, char pad)
public static java.lang.String rightPad(java.lang.String s, int len, char pad)
public static java.lang.String leftTrim(java.lang.String s)
public static java.lang.String rightTrim(java.lang.String s)
public static int charCount(java.lang.String s, char c)
public static java.lang.String addLFIfNotEmpty(java.lang.String s)
public static java.lang.String appendSeparator(java.lang.String s, java.lang.String separator)
public static java.lang.String chomp(java.lang.String s)
public static java.lang.String chop(java.lang.String s)
public static java.lang.String normalizeLF(java.lang.String s)
public static java.lang.String normalizeLF(java.lang.String s, java.lang.String newLineSeparator)
public static java.lang.String encodeUnicodeEscapesSingle(java.lang.String s)
public static char[] encodeUnicodeEscapesSingle(char[] s)
public static char[] encodeUnicodeEscapesSingle(char[] s, int off, int len)
public static java.lang.String decodeUnicodeEscapesSingle(java.lang.String s)
public static java.lang.String decodeUnicodeEscapes(java.lang.String s)
public static java.lang.String decodeUnicodeEscapes(java.lang.String s, boolean justDeleteFirstUInSequenceOfSeveralU)
public static char[] decodeUnicodeEscapesSingle(char[] s)
public static char[] decodeUnicodeEscapes(char[] s)
public static char[] decodeUnicodeEscapes(char[] s, boolean justDeleteFirstUInSequenceOfSeveralU)
public static char[] decodeUnicodeEscapesSingle(char[] s, int off, int len)
public static char[] decodeUnicodeEscapes(char[] s, int off, int len)
public static char[] decodeUnicodeEscapes(char[] s, int off, int len, boolean justDeleteFirstUInSequenceOfSeveralU)
public static java.lang.String ctrlsToJava(java.lang.String s)
public static java.lang.String javaToCtrls(java.lang.String s)
public static java.lang.String ctrlsToXml(java.lang.String s)
public static java.lang.String ctrlsToXml(java.lang.String s, boolean encodeForAttributes)
public static java.lang.String ctrlsToXml(java.lang.String s, boolean encodeForAttributes, boolean replaceLowCtrlsToSpace)
public static java.lang.String xmlToCtrls(java.lang.String s)
public static java.lang.String xmlToCtrls(java.lang.String s, int start, int end)
public static java.lang.StringBuffer xmlToCtrls(java.lang.String s, java.lang.StringBuffer sb)
public static java.lang.StringBuffer xmlToCtrls(java.lang.String s, int start, int end, java.lang.StringBuffer sb)
public static java.lang.String xmlAttr(java.lang.String attrName, java.lang.String value)
public static java.lang.String xmlTag(java.lang.String tagName, java.lang.String text)
public static java.lang.String xmlTag(java.lang.String tagName, java.lang.String text, boolean doEncodeText)
public static java.lang.String htmlPreformat(java.lang.String html, boolean enableWordWrap)
public static java.lang.String htmlPreformat(java.lang.String ascii, int tabLen, boolean enableWordWrap, boolean addMonospaceFontTag, boolean addHtmlTag)
public static java.lang.String htmlTable(java.lang.Object[][] cellValues)
public static java.lang.String htmlTable(java.lang.Object[][] cellValues, int flags)
public static java.lang.String htmlTable(java.lang.Object[][] cellValues, java.lang.String tableAttributes)
public static java.lang.String htmlTable(java.lang.Object[][] cellValues, java.lang.String tableAttributes, int flags)
public static java.lang.String htmlTable(java.lang.Object[][] cellValues, java.lang.String tableAttributes, java.lang.String[] tdAttributes)
public static java.lang.String htmlTable(java.lang.Object[][] cellValues, java.lang.String tableAttributes, java.lang.String[] tdAttributes, int flags)
public static Strings.NextInfo findNextQuote(char[] s, int start)
public static Strings.NextInfo findNextQuote(java.lang.String s, int start)
public static Strings.NextInfo findNextQuote(char[] s, int start, char quote)
public static Strings.NextInfo findNextQuote(java.lang.String s, int start, char quote)
public static Strings.NextInfo findSubstringIgnoringQuotedStart(java.lang.String s, java.lang.String match)
public static Strings.NextInfo findSubstringIgnoringQuotedStart(java.lang.String s, java.lang.String match, int start)
public static java.lang.String endSubstringIgnoringQuotedStart(java.lang.String s, int start)
public static java.lang.String[] split(java.lang.String s)
public static java.lang.String[] split(java.lang.String s, java.lang.String separators)
public static java.util.List splitAsList(java.lang.String s, java.lang.String separators)
public static java.lang.String[] splitStringWithQuotes(java.lang.String s, char separator)
public static void splitStringWithQuotes(java.lang.String s, char separator, java.util.List resultStrings)
public static java.lang.String javaNameToTagName(java.lang.String name)
public static java.lang.String javaNameToWords(java.lang.String name, java.lang.String separator)