public class StringUtil extends StringUtilRt
Modifier and Type | Class and Description |
---|---|
static class |
StringUtil.BombedCharSequence
Expirable CharSequence.
|
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
ELLIPSIS |
static NotNullFunction<java.lang.String,java.lang.String> |
QUOTER |
static NotNullFunction<java.lang.String,java.lang.String> |
SINGLE_QUOTER |
static Function<java.lang.String,java.lang.String> |
TRIMMER |
Constructor and Description |
---|
StringUtil() |
Modifier and Type | Method and Description |
---|---|
static void |
assertValidSeparators(java.lang.CharSequence s) |
static java.lang.String |
capitalize(java.lang.String s)
Capitalize the first letter of the sentence.
|
static java.lang.String |
capitalizeWithJavaBeanConvention(java.lang.String s) |
static java.lang.String |
capitalizeWords(java.lang.String text,
boolean allWords) |
static java.lang.String |
capitalizeWords(java.lang.String text,
java.lang.String tokenizerDelim,
boolean allWords,
boolean leaveOriginalDelims) |
static java.lang.String |
capitalsOnly(java.lang.String s) |
static boolean |
charsEqualIgnoreCase(char a,
char b) |
static boolean |
charsMatch(char c1,
char c2,
boolean ignoreCase) |
static java.lang.String |
collapseWhiteSpace(java.lang.CharSequence s)
Collapses all white-space (including new lines) between non-white-space characters to a single space character.
|
static java.lang.String |
commonPrefix(java.lang.String s1,
java.lang.String s2) |
static int |
commonPrefixLength(java.lang.CharSequence s1,
java.lang.CharSequence s2) |
static int |
commonPrefixLength(java.lang.CharSequence s1,
java.lang.CharSequence s2,
boolean ignoreCase) |
static java.lang.String |
commonSuffix(java.lang.String s1,
java.lang.String s2) |
static int |
commonSuffixLength(java.lang.CharSequence s1,
java.lang.CharSequence s2) |
static int |
compare(char c1,
char c2,
boolean ignoreCase) |
static int |
compare(java.lang.CharSequence s1,
java.lang.CharSequence s2,
boolean ignoreCase) |
static int |
compare(java.lang.String s1,
java.lang.String s2,
boolean ignoreCase) |
static int |
comparePairs(java.lang.String s1,
java.lang.String t1,
java.lang.String s2,
java.lang.String t2,
boolean ignoreCase) |
static int |
compareVersionNumbers(java.lang.String v1,
java.lang.String v2) |
static boolean |
contains(java.lang.CharSequence sequence,
java.lang.CharSequence infix) |
static boolean |
contains(java.lang.CharSequence s,
int start,
int end,
char c)
Allows to answer if target symbol is contained at given char sequence at
[start; end) interval. |
static boolean |
containsAlphaCharacters(java.lang.String value) |
static boolean |
containsAnyChar(java.lang.String value,
java.lang.String chars) |
static boolean |
containsAnyChar(java.lang.String value,
java.lang.String chars,
int start,
int end) |
static boolean |
containsChar(java.lang.String value,
char ch) |
static boolean |
containsIgnoreCase(java.lang.String where,
java.lang.String what) |
static boolean |
containsLineBreak(java.lang.CharSequence text) |
static boolean |
containsWhitespaces(java.lang.CharSequence s) |
static java.lang.String |
convertLineSeparators(java.lang.String text) |
static java.lang.String |
convertLineSeparators(java.lang.String text,
boolean keepCarriageReturn) |
static java.lang.String |
convertLineSeparators(java.lang.String text,
java.lang.String newSeparator) |
static java.lang.String |
convertLineSeparators(java.lang.String text,
java.lang.String newSeparator,
int [] offsetsToKeep) |
static int |
countChars(java.lang.CharSequence text,
char c) |
static int |
countChars(java.lang.CharSequence text,
char c,
int offset,
boolean stopAtOtherChar) |
static int |
countChars(java.lang.CharSequence text,
char c,
int start,
int end,
boolean stopAtOtherChar) |
static int |
countNewLines(java.lang.CharSequence text) |
static <T> Function<T,java.lang.String> |
createToStringFunction(java.lang.Class<T> cls) |
static java.lang.String |
decapitalize(java.lang.String s) |
static java.lang.String |
defaultIfEmpty(java.lang.String value,
java.lang.String defaultValue) |
static LineSeparator |
detectSeparators(java.lang.CharSequence text) |
static int |
difference(java.lang.String s1,
java.lang.String s2)
Classic dynamic programming algorithm for string differences.
|
static boolean |
endsWith(java.lang.CharSequence text,
java.lang.CharSequence suffix) |
static boolean |
endsWith(java.lang.CharSequence text,
int start,
int end,
java.lang.CharSequence suffix) |
static boolean |
endsWithChar(java.lang.CharSequence s,
char suffix) |
static boolean |
endsWithIgnoreCase(java.lang.String str,
java.lang.String suffix) |
static boolean |
endsWithLineBreak(java.lang.CharSequence text) |
static boolean |
equals(java.lang.CharSequence s1,
java.lang.CharSequence s2) |
static boolean |
equalsIgnoreCase(java.lang.CharSequence s1,
java.lang.CharSequence s2) |
static boolean |
equalsIgnoreWhitespaces(java.lang.CharSequence s1,
java.lang.CharSequence s2) |
static boolean |
equalsTrimWhitespaces(java.lang.CharSequence s1,
java.lang.CharSequence s2) |
static java.lang.String |
escapeBackSlashes(java.lang.String str) |
static void |
escapeChar(java.lang.StringBuilder buf,
char character) |
static java.lang.String |
escapeChar(java.lang.String str,
char character) |
static java.lang.String |
escapeCharCharacters(java.lang.String s) |
static java.lang.String |
escapeChars(java.lang.String str,
char... character) |
static java.lang.String |
escapeLineBreak(java.lang.String text) |
static java.lang.String |
escapeMnemonics(java.lang.String text) |
static java.lang.String |
escapePattern(java.lang.String text) |
static java.lang.String |
escapeProperty(java.lang.String input,
boolean isKey)
Escape property name or key in property file.
|
static java.lang.String |
escapeQuotes(java.lang.String str) |
static void |
escapeQuotes(java.lang.StringBuilder buf) |
static NotNullFunction<java.lang.String,java.lang.String> |
escaper(boolean escapeSlash,
java.lang.String additionalChars) |
static java.lang.String |
escapeSlashes(java.lang.String str) |
static void |
escapeSlashes(java.lang.StringBuilder buf) |
static java.lang.StringBuilder |
escapeStringCharacters(int length,
java.lang.String str,
java.lang.String additionalChars,
boolean escapeSlash,
boolean escapeUnicode,
java.lang.StringBuilder buffer) |
static java.lang.StringBuilder |
escapeStringCharacters(int length,
java.lang.String str,
java.lang.String additionalChars,
boolean escapeSlash,
java.lang.StringBuilder buffer) |
static void |
escapeStringCharacters(int length,
java.lang.String str,
java.lang.StringBuilder buffer) |
static java.lang.StringBuilder |
escapeStringCharacters(int length,
java.lang.String str,
java.lang.String additionalChars,
java.lang.StringBuilder buffer) |
static java.lang.String |
escapeStringCharacters(java.lang.String s) |
static java.lang.StringBuilder |
escapeToRegexp(java.lang.CharSequence text,
java.lang.StringBuilder builder) |
static java.lang.String |
escapeToRegexp(java.lang.String text) |
static java.lang.String |
escapeXml(java.lang.String text)
Deprecated.
Use
escapeXmlEntities(String) instead |
static java.lang.String |
escapeXmlEntities(java.lang.String text) |
static java.lang.String [] |
filterEmptyStrings(java.lang.String [] strings) |
static int |
findFirst(java.lang.CharSequence s,
CharFilter filter)
Find position of the first character accepted by given filter.
|
static boolean |
findIgnoreCase(java.lang.String toFind,
java.lang.String... where) |
static java.util.List<java.lang.String> |
findMatches(java.lang.String s,
java.util.regex.Pattern pattern) |
static java.util.List<java.lang.String> |
findMatches(java.lang.String s,
java.util.regex.Pattern pattern,
int groupIndex) |
static java.lang.CharSequence |
first(java.lang.CharSequence text,
int length,
boolean appendEllipsis) |
static java.lang.String |
first(java.lang.String text,
int maxLength,
boolean appendEllipsis) |
static java.lang.String |
firstLast(java.lang.String text,
int length) |
static java.lang.String |
firstLetterToUpperCase(java.lang.String displayString)
Deprecated.
use #capitalize(String)
|
static java.lang.String |
fixVariableNameDerivedFromPropertyName(java.lang.String name) |
static java.lang.String |
formatDuration(long duration)
Formats duration given in milliseconds as a sum of time units (example:
formatDuration(123456) = "2 m 3 s 456 ms" ). |
static java.lang.String |
formatDuration(long duration,
java.lang.String unitSeparator)
Formats duration given in milliseconds as a sum of time units (example:
formatDuration(123456, "") = "2m 3s 456ms" ). |
static java.lang.String |
formatDurationApproximate(long duration)
Formats duration given in milliseconds as a sum of time units with at most two units
(example:
formatDuration(123456) = "2 m 3 s" ). |
static java.lang.String |
formatDurationPadded(long millis,
java.lang.String unitSeparator)
Formats duration given in milliseconds as a sum of padded time units, except the most significant unit
E.g.
|
static java.lang.String |
formatFileSize(long fileSize)
Formats given file size in metric (1 kB = 1000 B) units (example:
formatFileSize(1234) = "1.23 KB" ). |
static java.lang.String |
formatFileSize(long fileSize,
java.lang.String unitSeparator)
Formats given file size in metric (1 kB = 1000 B) units (example:
formatFileSize(1234, "") = "1.23KB" ). |
static java.lang.String |
formatLinks(java.lang.String message) |
static java.lang.String |
formatOrdinal(long num)
Appends English ordinal suffix to the given number.
|
static int |
getIgnoreCaseOccurrenceCount(java.lang.String text,
java.lang.String s) |
static int |
getLineBreakCount(java.lang.CharSequence text) |
static LineSeparator |
getLineSeparatorAt(java.lang.CharSequence text,
int index) |
static java.lang.String |
getMessage(java.lang.Throwable e) |
static int |
getOccurrenceCount(java.lang.String text,
char c) |
static int |
getOccurrenceCount(java.lang.String text,
java.lang.String s) |
static java.lang.String |
getPackageName(java.lang.String fqName) |
static java.lang.String |
getPackageName(java.lang.String fqName,
char separator)
Given a fqName returns the package name for the type or the containing type.
|
static java.lang.String |
getPropertyName(java.lang.String methodName) |
static java.lang.String |
getQualifiedName(java.lang.String packageName,
java.lang.String className) |
static java.lang.String |
getShortName(java.lang.Class<?> aClass) |
static java.lang.String |
getShortName(java.lang.String fqName) |
static java.lang.String |
getShortName(java.lang.String fqName,
char separator) |
static java.lang.String |
getThrowableText(java.lang.Throwable aThrowable) |
static java.util.List<TextRange> |
getWordIndicesIn(java.lang.String text) |
static java.util.List<TextRange> |
getWordIndicesIn(java.lang.String text,
java.util.Set<java.lang.Character> separatorsSet) |
static java.util.List<java.lang.String> |
getWordsIn(java.lang.String text) |
static java.util.List<java.lang.String> |
getWordsInStringLongestFirst(java.lang.String find) |
static java.util.List<Pair<java.lang.String,java.lang.Integer>> |
getWordsWithOffset(java.lang.String s) |
static boolean |
hasLowerCaseChar(java.lang.String s)
Does the string have a lowercase character?
|
static boolean |
hasUpperCaseChar(java.lang.String s)
Does the string have an uppercase character?
|
static java.lang.String |
htmlEmphasize(java.lang.String text) |
static int |
indexOf(char [] s,
char c,
int start,
int end,
boolean caseSensitive) |
static int |
indexOf(java.lang.CharSequence s,
char c) |
static int |
indexOf(java.lang.CharSequence s,
char c,
int start) |
static int |
indexOf(java.lang.CharSequence s,
char c,
int start,
int end) |
static int |
indexOf(java.lang.CharSequence s,
char c,
int start,
int end,
boolean caseSensitive) |
static int |
indexOf(java.lang.CharSequence sequence,
java.lang.CharSequence infix) |
static int |
indexOf(java.lang.CharSequence sequence,
java.lang.CharSequence infix,
int start) |
static int |
indexOf(java.lang.CharSequence sequence,
java.lang.CharSequence infix,
int start,
int end) |
static int |
indexOfAny(java.lang.CharSequence s,
java.lang.String chars) |
static int |
indexOfAny(java.lang.CharSequence s,
java.lang.String chars,
int start,
int end) |
static int |
indexOfAny(java.lang.String s,
java.lang.String chars) |
static int |
indexOfAny(java.lang.String s,
java.lang.String chars,
int start,
int end) |
static int |
indexOfIgnoreCase(java.lang.CharSequence where,
java.lang.CharSequence what,
int fromIndex)
Implementation copied from
String.indexOf(String, int) except character comparisons made case insensitive |
static int |
indexOfIgnoreCase(java.lang.String where,
char what,
int fromIndex) |
static int |
indexOfIgnoreCase(java.lang.String where,
java.lang.String what,
int fromIndex) |
static int |
indexOfSubstringEnd(java.lang.String text,
java.lang.String subString) |
static java.lang.String |
internEmptyString(java.lang.String s) |
static boolean |
isBetween(java.lang.String string,
java.lang.String smallPart,
java.lang.String bigPart)
Say smallPart = "op" and bigPart="open".
|
static boolean |
isCapitalized(java.lang.String s) |
static boolean |
isChar(java.lang.CharSequence seq,
int index,
char c) |
static boolean |
isDecimalDigit(char c) |
static boolean |
isEmpty(java.lang.CharSequence cs) |
static boolean |
isEmpty(java.lang.String s) |
static boolean |
isEmptyOrSpaces(java.lang.CharSequence s) |
static boolean |
isEmptyOrSpaces(java.lang.String s) |
static boolean |
isEscapedBackslash(char [] chars,
int startOffset,
int backslashOffset) |
static boolean |
isEscapedBackslash(java.lang.CharSequence text,
int startOffset,
int backslashOffset) |
static boolean |
isHexDigit(char c) |
static boolean |
isJavaIdentifier(java.lang.String text) |
static boolean |
isJavaIdentifierPart(char c) |
static boolean |
isJavaIdentifierStart(char c) |
static boolean |
isLatinAlphanumeric(java.lang.CharSequence str) |
static boolean |
isLineBreak(char c) |
static boolean |
isNotEmpty(java.lang.String s) |
static boolean |
isNotNegativeNumber(java.lang.CharSequence s) |
static boolean |
isOctalDigit(char c) |
static boolean |
isPreposition(java.lang.String s,
int firstChar,
int lastChar)
Deprecated.
|
static boolean |
isPreposition(java.lang.String s,
int firstChar,
int lastChar,
java.lang.String [] prepositions) |
static boolean |
isPrintableUnicode(char c) |
static boolean |
isQuotedString(java.lang.String s) |
static boolean |
isShortNameOf(java.lang.String fqName,
java.lang.String shortName)
Equivalent for
getShortName(fqName).equals(shortName) , but could be faster. |
static boolean |
isUpperCase(java.lang.CharSequence sequence) |
static boolean |
isVowel(char c) |
static boolean |
isWhiteSpace(char c)
Allows to answer if given symbol is white space, tabulation or line feed.
|
static <T> java.lang.String |
join(java.util.Collection<? extends T> items,
Function<? super T,java.lang.String> f,
java.lang.String separator) |
static java.lang.String |
join(java.util.Collection<java.lang.String> strings,
java.lang.String separator) |
static void |
join(java.util.Collection<java.lang.String> strings,
java.lang.String separator,
java.lang.StringBuilder result) |
static java.lang.String |
join(int [] strings,
java.lang.String separator) |
static java.lang.String |
join(java.lang.Iterable<?> items,
java.lang.String separator) |
static <T> java.lang.String |
join(java.lang.Iterable<? extends T> items,
Function<? super T,? extends java.lang.CharSequence> f,
java.lang.String separator) |
static <T> void |
join(java.lang.Iterable<? extends T> items,
Function<? super T,? extends java.lang.CharSequence> f,
java.lang.String separator,
java.lang.StringBuilder result) |
static java.lang.String |
join(java.lang.String... strings) |
static java.lang.String |
join(java.lang.String [] strings,
int startIndex,
int endIndex,
java.lang.String separator) |
static java.lang.String |
join(java.lang.String [] strings,
java.lang.String separator) |
static <T> java.lang.String |
join(T [] items,
Function<? super T,java.lang.String> f,
java.lang.String separator) |
static java.util.stream.Collector<java.lang.CharSequence,?,java.lang.String> |
joining() |
static java.lang.String |
joinOrNull(java.lang.String... args) |
static java.lang.CharSequence |
last(java.lang.CharSequence text,
int length,
boolean prependEllipsis) |
static int |
lastIndexOf(java.lang.CharSequence s,
char c,
int start,
int end)
Allows to retrieve index of last occurrence of the given symbols at
[start; end) sub-sequence of the given text. |
static int |
lastIndexOfAny(java.lang.CharSequence s,
java.lang.String chars) |
static int |
lastIndexOfIgnoreCase(java.lang.String where,
char what,
int fromIndex) |
static int |
length(java.lang.CharSequence cs) |
static int |
lineColToOffset(java.lang.CharSequence text,
int line,
int col) |
static int |
naturalCompare(java.lang.String string1,
java.lang.String string2) |
static java.lang.CharSequence |
newBombedCharSequence(java.lang.CharSequence sequence,
long delay) |
static java.lang.String |
notNullize(java.lang.String s) |
static java.lang.String |
notNullize(java.lang.String s,
java.lang.String defaultValue) |
static java.lang.String |
nullize(java.lang.String s) |
static java.lang.String |
nullize(java.lang.String s,
boolean nullizeSpaces) |
static java.lang.String |
nullize(java.lang.String s,
java.lang.String defaultValue) |
static LineColumn |
offsetToLineColumn(java.lang.CharSequence text,
int offset) |
static int |
offsetToLineNumber(java.lang.CharSequence text,
int offset) |
static double |
parseDouble(java.lang.String string,
double defaultValue) |
static <E extends java.lang.Enum<E>> |
parseEnum(java.lang.String string,
E defaultValue,
java.lang.Class<E> clazz) |
static byte [] |
parseHexString(java.lang.String str) |
static int |
parseInt(java.lang.String string,
int defaultValue) |
static long |
parseLong(java.lang.String string,
long defaultValue) |
static java.lang.String |
pluralize(java.lang.String word) |
static java.lang.String |
pluralize(java.lang.String base,
int count) |
static void |
quote(java.lang.StringBuilder builder) |
static void |
quote(java.lang.StringBuilder builder,
char quotingChar) |
static java.lang.String |
removeEllipsisSuffix(java.lang.String s) |
static java.lang.String |
removeHtmlTags(java.lang.String htmlString) |
static java.lang.String |
removeHtmlTags(java.lang.String htmlString,
boolean isRemoveStyleTag) |
static java.lang.String |
repeat(java.lang.String s,
int count) |
static void |
repeatSymbol(java.lang.Appendable buffer,
char symbol,
int times) |
static java.lang.String |
repeatSymbol(char aChar,
int count) |
static java.lang.String |
replace(java.lang.String text,
java.util.List<java.lang.String> from,
java.util.List<java.lang.String> to) |
static java.lang.String |
replace(java.lang.String text,
java.lang.String [] from,
java.lang.String [] to)
Deprecated.
|
static java.lang.String |
replace(java.lang.String text,
java.lang.String oldS,
java.lang.String newS) |
static java.lang.String |
replace(java.lang.String text,
java.lang.String oldS,
java.lang.String newS,
boolean ignoreCase) |
static java.lang.String |
replaceChar(java.lang.String buffer,
char oldChar,
char newChar)
Deprecated.
Use
String.replace(char,char) instead |
static java.lang.String |
replaceIgnoreCase(java.lang.String text,
java.lang.String oldS,
java.lang.String newS) |
static MergingCharSequence |
replaceSubSequence(java.lang.CharSequence charSeq,
int start,
int end,
java.lang.CharSequence replacement) |
static java.lang.String |
replaceSubstring(java.lang.String string,
TextRange range,
java.lang.String replacement) |
static java.lang.String |
replaceUnicodeEscapeSequences(java.lang.String text) |
static java.lang.String |
sanitizeJavaIdentifier(java.lang.String name) |
static java.lang.String |
shortenPathWithEllipsis(java.lang.String path,
int maxLength) |
static java.lang.String |
shortenPathWithEllipsis(java.lang.String path,
int maxLength,
boolean useEllipsisSymbol) |
static java.lang.String |
shortenTextWithEllipsis(java.lang.String text,
int maxLength,
int suffixLength) |
static java.lang.String |
shortenTextWithEllipsis(java.lang.String text,
int maxLength,
int suffixLength,
boolean useEllipsisSymbol) |
static java.lang.String |
shortenTextWithEllipsis(java.lang.String text,
int maxLength,
int suffixLength,
java.lang.String symbol) |
static int |
skipWhitespaceBackward(java.lang.CharSequence text,
int pos)
Finds the previous position in the supplied CharSequence which is neither a space nor a tab.
|
static int |
skipWhitespaceForward(java.lang.CharSequence text,
int pos)
Finds the next position in the supplied CharSequence which is neither a space nor a tab.
|
static java.util.List<java.lang.CharSequence> |
split(java.lang.CharSequence s,
java.lang.CharSequence separator) |
static java.util.List<java.lang.CharSequence> |
split(java.lang.CharSequence s,
java.lang.CharSequence separator,
boolean excludeSeparator,
boolean excludeEmptyStrings) |
static java.util.List<java.lang.String> |
split(java.lang.String s,
java.lang.String separator) |
static java.util.List<java.lang.String> |
split(java.lang.String s,
java.lang.String separator,
boolean excludeSeparator) |
static java.util.List<java.lang.String> |
split(java.lang.String s,
java.lang.String separator,
boolean excludeSeparator,
boolean excludeEmptyStrings) |
static java.lang.String [] |
splitByLines(java.lang.String string)
Splits string by lines.
|
static java.lang.String [] |
splitByLines(java.lang.String string,
boolean excludeEmptyStrings)
Splits string by lines.
|
static java.lang.String [] |
splitByLinesDontTrim(java.lang.String string) |
static java.lang.String [] |
splitByLinesKeepSeparators(java.lang.String string)
Splits string by lines, keeping all line separators at the line ends and in the empty lines.
|
static java.util.List<java.lang.String> |
splitHonorQuotes(java.lang.String s,
char separator) |
static boolean |
startsWith(java.lang.CharSequence text,
java.lang.CharSequence prefix) |
static boolean |
startsWith(java.lang.CharSequence text,
int startIndex,
java.lang.CharSequence prefix) |
static boolean |
startsWithChar(java.lang.CharSequence s,
char prefix) |
static boolean |
startsWithConcatenation(java.lang.String string,
java.lang.String... prefixes)
Equivalent to string.startsWith(prefixes[0] + prefixes[1] + ...) but avoids creating an object for concatenation.
|
static boolean |
startsWithConcatenationOf(java.lang.String string,
java.lang.String firstPrefix,
java.lang.String secondPrefix)
Deprecated.
|
static boolean |
startsWithIgnoreCase(java.lang.String str,
java.lang.String prefix) |
static boolean |
startsWithWhitespace(java.lang.String text) |
static int |
stringHashCode(char[] chars,
int from,
int to) |
static int |
stringHashCode(java.lang.CharSequence chars) |
static int |
stringHashCode(java.lang.CharSequence chars,
int from,
int to) |
static int |
stringHashCode(java.lang.CharSequence chars,
int from,
int to,
int prefixHash) |
static int |
stringHashCodeIgnoreWhitespaces(char [] chars,
int from,
int to) |
static int |
stringHashCodeIgnoreWhitespaces(java.lang.CharSequence chars) |
static int |
stringHashCodeIgnoreWhitespaces(java.lang.CharSequence chars,
int from,
int to) |
static int |
stringHashCodeInsensitive(char [] chars,
int from,
int to) |
static int |
stringHashCodeInsensitive(java.lang.CharSequence chars) |
static int |
stringHashCodeInsensitive(java.lang.CharSequence chars,
int from,
int to) |
static int |
stringHashCodeInsensitive(java.lang.CharSequence chars,
int from,
int to,
int prefixHash) |
static java.lang.String |
strip(java.lang.String s,
CharFilter filter)
Strip out all characters not accepted by given filter
|
static java.lang.String |
stripHtml(java.lang.String html,
boolean convertBreaks) |
static java.lang.String |
stripQuotesAroundValue(java.lang.String text)
Consider using
unquoteString(String) instead. |
static java.lang.String |
substringAfter(java.lang.String text,
java.lang.String subString) |
static java.lang.String |
substringAfterLast(java.lang.String text,
java.lang.String subString) |
static java.lang.String |
substringBefore(java.lang.String text,
java.lang.String subString) |
static java.lang.String |
substringBeforeLast(java.lang.String text,
java.lang.String subString) |
static java.lang.String [] |
surround(java.lang.String [] strings,
java.lang.String prefix,
java.lang.String suffix) |
static java.lang.String |
tail(java.lang.String s,
int idx) |
static java.lang.String |
toHexString(byte [] bytes) |
static java.lang.Iterable<java.lang.String> |
tokenize(java.lang.String s,
java.lang.String separators) |
static java.lang.Iterable<java.lang.String> |
tokenize(java.util.StringTokenizer tokenizer) |
static char |
toLowerCase(char a) |
static java.lang.String |
toLowerCase(java.lang.String str) |
static java.lang.String |
toTitleCase(java.lang.String s) |
static char |
toUpperCase(char a) |
static java.lang.String |
toUpperCase(java.lang.String s) |
static java.lang.String |
trim(java.lang.String s) |
static java.lang.String |
trim(java.lang.String s,
CharFilter filter)
Trim all characters not accepted by given filter
|
static boolean |
trimEnd(java.lang.StringBuilder buffer,
java.lang.CharSequence end) |
static java.lang.String |
trimEnd(java.lang.String s,
char suffix) |
static java.lang.String |
trimEnd(java.lang.String s,
java.lang.String suffix) |
static java.lang.String |
trimEnd(java.lang.String s,
java.lang.String suffix,
boolean ignoreCase) |
static java.lang.String |
trimExtensions(java.lang.String name) |
static java.lang.CharSequence |
trimLeading(java.lang.CharSequence string) |
static java.lang.String |
trimLeading(java.lang.String string) |
static java.lang.StringBuilder |
trimLeading(java.lang.StringBuilder builder,
char symbol) |
static java.lang.String |
trimLeading(java.lang.String string,
char symbol) |
static java.lang.String |
trimLog(java.lang.String text,
int limit) |
static java.lang.String |
trimMiddle(java.lang.String text,
int maxLength) |
static java.lang.String |
trimStart(java.lang.String s,
java.lang.String prefix) |
static java.lang.CharSequence |
trimTrailing(java.lang.CharSequence string) |
static java.lang.String |
trimTrailing(java.lang.String string) |
static java.lang.StringBuilder |
trimTrailing(java.lang.StringBuilder builder,
char symbol) |
static java.lang.String |
trimTrailing(java.lang.String string,
char symbol) |
static java.lang.String |
unescapeBackSlashes(java.lang.String str) |
static java.lang.String |
unescapeChar(java.lang.String str,
char unescapeChar) |
static java.lang.String |
unescapeSlashes(java.lang.String str) |
static java.lang.String |
unescapeStringCharacters(java.lang.String s) |
static java.lang.String |
unescapeXml(java.lang.String text)
Deprecated.
Use
unescapeXmlEntities(String) instead |
static java.lang.String |
unescapeXmlEntities(java.lang.String text) |
static java.lang.String |
unpluralize(java.lang.String word)
Returns unpluralized variant using English based heuristics like properties -> property, names -> name, children -> child.
|
static java.lang.String |
unquoteString(java.lang.String s) |
static java.lang.String |
unquoteString(java.lang.String s,
char quotationChar) |
static java.lang.String |
wordsToBeginFromLowerCase(java.lang.String s) |
static java.lang.String |
wordsToBeginFromUpperCase(java.lang.String s) |
static java.lang.String |
wrapWithDoubleQuote(java.lang.String str) |
static java.lang.String [] |
zip(java.lang.String [] strings1,
java.lang.String [] strings2,
java.lang.String separator) |
convertLineSeparators, convertLineSeparators, convertLineSeparators, endsWithIgnoreCase, equal
public static final java.lang.String ELLIPSIS
public static final NotNullFunction<java.lang.String,java.lang.String> QUOTER
public static final NotNullFunction<java.lang.String,java.lang.String> SINGLE_QUOTER
public static final Function<java.lang.String,java.lang.String> TRIMMER
public static MergingCharSequence replaceSubSequence(java.lang.CharSequence charSeq, int start, int end, java.lang.CharSequence replacement)
[start, end)
range in the charSeq
with replacement
.
Works in O(1), but retains references to the passed char sequences, so please use something else if you want them to be garbage-collected.public static java.util.List<java.lang.String> getWordsInStringLongestFirst(java.lang.String find)
public static java.lang.String escapePattern(java.lang.String text)
public static <T> Function<T,java.lang.String> createToStringFunction(java.lang.Class<T> cls)
public static java.lang.String replace(java.lang.String text, java.lang.String oldS, java.lang.String newS)
public static java.lang.String replaceIgnoreCase(java.lang.String text, java.lang.String oldS, java.lang.String newS)
@Deprecated public static java.lang.String replaceChar(java.lang.String buffer, char oldChar, char newChar)
String.replace(char,char)
insteadpublic static java.lang.String replace(java.lang.String text, java.lang.String oldS, java.lang.String newS, boolean ignoreCase)
public static int indexOfIgnoreCase(java.lang.String where, java.lang.String what, int fromIndex)
public static int indexOfIgnoreCase(java.lang.CharSequence where, java.lang.CharSequence what, int fromIndex)
String.indexOf(String, int)
except character comparisons made case insensitivepublic static int indexOfIgnoreCase(java.lang.String where, char what, int fromIndex)
public static int lastIndexOfIgnoreCase(java.lang.String where, char what, int fromIndex)
public static boolean containsIgnoreCase(java.lang.String where, java.lang.String what)
public static boolean endsWithIgnoreCase(java.lang.String str, java.lang.String suffix)
public static boolean startsWithIgnoreCase(java.lang.String str, java.lang.String prefix)
public static java.lang.String stripHtml(java.lang.String html, boolean convertBreaks)
public static java.lang.String toLowerCase(java.lang.String str)
public static java.lang.String getPackageName(java.lang.String fqName)
public static java.lang.String getPackageName(java.lang.String fqName, char separator)
java.lang.String
-> java.lang
java.util.Map.Entry
-> java.util.Map
fqName
- a fully qualified type name. Not supposed to contain any type argumentsseparator
- the separator to use. Typically '.'public static int getLineBreakCount(java.lang.CharSequence text)
public static boolean containsLineBreak(java.lang.CharSequence text)
public static boolean isLineBreak(char c)
public static java.lang.String escapeLineBreak(java.lang.String text)
public static boolean endsWithLineBreak(java.lang.CharSequence text)
public static int lineColToOffset(java.lang.CharSequence text, int line, int col)
public static int offsetToLineNumber(java.lang.CharSequence text, int offset)
public static LineColumn offsetToLineColumn(java.lang.CharSequence text, int offset)
public static int difference(java.lang.String s1, java.lang.String s2)
public static java.lang.String wordsToBeginFromUpperCase(java.lang.String s)
public static java.lang.String wordsToBeginFromLowerCase(java.lang.String s)
public static java.lang.String toTitleCase(java.lang.String s)
@Deprecated public static boolean isPreposition(java.lang.String s, int firstChar, int lastChar)
isPreposition(String, int, int, String[])
.public static boolean isPreposition(java.lang.String s, int firstChar, int lastChar, java.lang.String [] prepositions)
public static NotNullFunction<java.lang.String,java.lang.String> escaper(boolean escapeSlash, java.lang.String additionalChars)
public static void escapeStringCharacters(int length, java.lang.String str, java.lang.StringBuilder buffer)
public static java.lang.StringBuilder escapeStringCharacters(int length, java.lang.String str, java.lang.String additionalChars, java.lang.StringBuilder buffer)
public static java.lang.StringBuilder escapeStringCharacters(int length, java.lang.String str, java.lang.String additionalChars, boolean escapeSlash, java.lang.StringBuilder buffer)
public static java.lang.StringBuilder escapeStringCharacters(int length, java.lang.String str, java.lang.String additionalChars, boolean escapeSlash, boolean escapeUnicode, java.lang.StringBuilder buffer)
public static boolean isPrintableUnicode(char c)
public static java.lang.String escapeStringCharacters(java.lang.String s)
public static java.lang.String escapeCharCharacters(java.lang.String s)
public static java.lang.String unescapeStringCharacters(java.lang.String s)
public static boolean isQuotedString(java.lang.String s)
public static java.lang.String unquoteString(java.lang.String s)
public static java.lang.String unquoteString(java.lang.String s, char quotationChar)
public static java.lang.String pluralize(java.lang.String word)
public static java.lang.String capitalizeWords(java.lang.String text, boolean allWords)
public static java.lang.String capitalizeWords(java.lang.String text, java.lang.String tokenizerDelim, boolean allWords, boolean leaveOriginalDelims)
public static java.lang.String decapitalize(java.lang.String s)
public static boolean isVowel(char c)
public static java.lang.String capitalize(java.lang.String s)
public static boolean isCapitalized(java.lang.String s)
public static java.lang.String capitalizeWithJavaBeanConvention(java.lang.String s)
public static int stringHashCode(java.lang.CharSequence chars)
public static int stringHashCode(java.lang.CharSequence chars, int from, int to)
public static int stringHashCode(java.lang.CharSequence chars, int from, int to, int prefixHash)
public static int stringHashCode(char[] chars, int from, int to)
public static int stringHashCodeInsensitive(char [] chars, int from, int to)
public static int stringHashCodeInsensitive(java.lang.CharSequence chars, int from, int to)
public static int stringHashCodeInsensitive(java.lang.CharSequence chars, int from, int to, int prefixHash)
public static int stringHashCodeInsensitive(java.lang.CharSequence chars)
public static int stringHashCodeIgnoreWhitespaces(char [] chars, int from, int to)
public static int stringHashCodeIgnoreWhitespaces(java.lang.CharSequence chars, int from, int to)
public static int stringHashCodeIgnoreWhitespaces(java.lang.CharSequence chars)
public static boolean startsWithConcatenation(java.lang.String string, java.lang.String... prefixes)
public static java.lang.String trim(java.lang.String s)
public static java.lang.String trimEnd(java.lang.String s, java.lang.String suffix)
public static java.lang.String trimEnd(java.lang.String s, java.lang.String suffix, boolean ignoreCase)
public static java.lang.String trimEnd(java.lang.String s, char suffix)
public static java.lang.String trimLog(java.lang.String text, int limit)
public static java.lang.String trimLeading(java.lang.String string)
public static java.lang.CharSequence trimLeading(java.lang.CharSequence string)
public static java.lang.String trimLeading(java.lang.String string, char symbol)
public static java.lang.StringBuilder trimLeading(java.lang.StringBuilder builder, char symbol)
public static java.lang.String trimTrailing(java.lang.String string)
public static java.lang.CharSequence trimTrailing(java.lang.CharSequence string)
public static java.lang.String trimTrailing(java.lang.String string, char symbol)
public static java.lang.StringBuilder trimTrailing(java.lang.StringBuilder builder, char symbol)
public static boolean startsWithChar(java.lang.CharSequence s, char prefix)
public static boolean endsWithChar(java.lang.CharSequence s, char suffix)
public static java.lang.String trimStart(java.lang.String s, java.lang.String prefix)
public static java.lang.String trimExtensions(java.lang.String name)
public static java.lang.String pluralize(java.lang.String base, int count)
public static void repeatSymbol(java.lang.Appendable buffer, char symbol, int times)
public static java.lang.String defaultIfEmpty(java.lang.String value, java.lang.String defaultValue)
public static boolean isNotEmpty(java.lang.String s)
public static boolean isEmpty(java.lang.String s)
public static boolean isEmpty(java.lang.CharSequence cs)
public static int length(java.lang.CharSequence cs)
public static java.lang.String notNullize(java.lang.String s)
public static java.lang.String notNullize(java.lang.String s, java.lang.String defaultValue)
public static java.lang.String nullize(java.lang.String s)
public static java.lang.String nullize(java.lang.String s, java.lang.String defaultValue)
public static java.lang.String nullize(java.lang.String s, boolean nullizeSpaces)
public static boolean isEmptyOrSpaces(java.lang.String s)
public static boolean isEmptyOrSpaces(java.lang.CharSequence s)
public static boolean isWhiteSpace(char c)
c
- symbol to checktrue
if given symbol is white space, tabulation or line feed; false
otherwisepublic static java.lang.String getThrowableText(java.lang.Throwable aThrowable)
public static java.lang.String getMessage(java.lang.Throwable e)
public static java.lang.String repeatSymbol(char aChar, int count)
public static java.lang.String repeat(java.lang.String s, int count)
public static java.util.List<java.lang.String> splitHonorQuotes(java.lang.String s, char separator)
public static java.util.List<java.lang.String> split(java.lang.String s, java.lang.String separator)
public static java.util.List<java.lang.CharSequence> split(java.lang.CharSequence s, java.lang.CharSequence separator)
public static java.util.List<java.lang.String> split(java.lang.String s, java.lang.String separator, boolean excludeSeparator)
public static java.util.List<java.lang.String> split(java.lang.String s, java.lang.String separator, boolean excludeSeparator, boolean excludeEmptyStrings)
public static java.util.List<java.lang.CharSequence> split(java.lang.CharSequence s, java.lang.CharSequence separator, boolean excludeSeparator, boolean excludeEmptyStrings)
public static java.lang.Iterable<java.lang.String> tokenize(java.lang.String s, java.lang.String separators)
public static java.lang.Iterable<java.lang.String> tokenize(java.util.StringTokenizer tokenizer)
public static java.util.List<java.lang.String> getWordsIn(java.lang.String text)
text
, or ContainerUtil.emptyList()
if there are none.
The word here means the maximum sub-string consisting entirely of characters which are Character.isJavaIdentifierPart(c)
.public static java.util.List<TextRange> getWordIndicesIn(java.lang.String text)
public static java.util.List<TextRange> getWordIndicesIn(java.lang.String text, java.util.Set<java.lang.Character> separatorsSet)
text
- text to get word ranges in.separatorsSet
- if not null, only these characters will be considered as separators (i.e. not a part of word).
Otherwise Character.isJavaIdentifierPart(char)
will be used to determine whether a symbol is part of word.public static java.lang.String join(java.lang.String [] strings, java.lang.String separator)
public static java.lang.String join(java.lang.String [] strings, int startIndex, int endIndex, java.lang.String separator)
public static java.lang.String [] zip(java.lang.String [] strings1, java.lang.String [] strings2, java.lang.String separator)
public static java.lang.String [] surround(java.lang.String [] strings, java.lang.String prefix, java.lang.String suffix)
public static <T> java.lang.String join(T [] items, Function<? super T,java.lang.String> f, java.lang.String separator)
public static <T> java.lang.String join(java.util.Collection<? extends T> items, Function<? super T,java.lang.String> f, java.lang.String separator)
public static java.lang.String join(java.lang.Iterable<?> items, java.lang.String separator)
public static <T> java.lang.String join(java.lang.Iterable<? extends T> items, Function<? super T,? extends java.lang.CharSequence> f, java.lang.String separator)
public static <T> void join(java.lang.Iterable<? extends T> items, Function<? super T,? extends java.lang.CharSequence> f, java.lang.String separator, java.lang.StringBuilder result)
public static java.lang.String join(java.util.Collection<java.lang.String> strings, java.lang.String separator)
public static void join(java.util.Collection<java.lang.String> strings, java.lang.String separator, java.lang.StringBuilder result)
public static java.lang.String join(int [] strings, java.lang.String separator)
public static java.lang.String join(java.lang.String... strings)
public static java.util.stream.Collector<java.lang.CharSequence,?,java.lang.String> joining()
public static java.lang.String stripQuotesAroundValue(java.lang.String text)
unquoteString(String)
instead.
Note: this method has an odd behavior:
Quotes are removed even if leading and trailing quotes are different or
if there is only one quote (leading or trailing).public static java.lang.String formatFileSize(long fileSize)
formatFileSize(1234) = "1.23 KB"
).public static java.lang.String formatFileSize(long fileSize, java.lang.String unitSeparator)
formatFileSize(1234, "") = "1.23KB"
).public static java.lang.String formatDuration(long duration)
formatDuration(123456) = "2 m 3 s 456 ms"
).public static java.lang.String formatDuration(long duration, java.lang.String unitSeparator)
formatDuration(123456, "") = "2m 3s 456ms"
).public static java.lang.String formatDurationPadded(long millis, java.lang.String unitSeparator)
public static java.lang.String formatDurationApproximate(long duration)
formatDuration(123456) = "2 m 3 s"
).public static java.lang.String formatOrdinal(long num)
public static java.lang.String unpluralize(java.lang.String word)
null
if failed to match appropriate heuristic.word
- english word in plural formnull
if failed to find one.public static boolean containsAlphaCharacters(java.lang.String value)
public static boolean containsAnyChar(java.lang.String value, java.lang.String chars)
public static boolean containsAnyChar(java.lang.String value, java.lang.String chars, int start, int end)
public static boolean containsChar(java.lang.String value, char ch)
@Deprecated public static java.lang.String firstLetterToUpperCase(java.lang.String displayString)
public static java.lang.String strip(java.lang.String s, CharFilter filter)
s
- e.g. "/n my string "filter
- e.g. CharFilter.NOT_WHITESPACE_FILTER
public static java.lang.String trim(java.lang.String s, CharFilter filter)
s
- e.g. "/n my string "filter
- e.g. CharFilter.NOT_WHITESPACE_FILTER
public static java.util.List<java.lang.String> findMatches(java.lang.String s, java.util.regex.Pattern pattern)
public static java.util.List<java.lang.String> findMatches(java.lang.String s, java.util.regex.Pattern pattern, int groupIndex)
public static int findFirst(java.lang.CharSequence s, CharFilter filter)
s
- the string to searchfilter
- search filterpublic static java.lang.String replaceSubstring(java.lang.String string, TextRange range, java.lang.String replacement)
public static boolean startsWithWhitespace(java.lang.String text)
public static boolean isChar(java.lang.CharSequence seq, int index, char c)
public static boolean startsWith(java.lang.CharSequence text, java.lang.CharSequence prefix)
public static boolean startsWith(java.lang.CharSequence text, int startIndex, java.lang.CharSequence prefix)
public static boolean endsWith(java.lang.CharSequence text, java.lang.CharSequence suffix)
public static boolean endsWith(java.lang.CharSequence text, int start, int end, java.lang.CharSequence suffix)
public static java.lang.String commonPrefix(java.lang.String s1, java.lang.String s2)
public static int commonPrefixLength(java.lang.CharSequence s1, java.lang.CharSequence s2)
public static int commonPrefixLength(java.lang.CharSequence s1, java.lang.CharSequence s2, boolean ignoreCase)
public static java.lang.String commonSuffix(java.lang.String s1, java.lang.String s2)
public static int commonSuffixLength(java.lang.CharSequence s1, java.lang.CharSequence s2)
public static boolean contains(java.lang.CharSequence s, int start, int end, char c)
[start; end)
interval.s
- target char sequence to checkstart
- start offset to use within the given char sequence (inclusive)end
- end offset to use within the given char sequence (exclusive)c
- target symbol to checktrue
if given symbol is contained at the target range of the given char sequence;
false
otherwisepublic static boolean containsWhitespaces(java.lang.CharSequence s)
public static int indexOf(java.lang.CharSequence s, char c)
public static int indexOf(java.lang.CharSequence s, char c, int start)
public static int indexOf(java.lang.CharSequence s, char c, int start, int end)
public static boolean contains(java.lang.CharSequence sequence, java.lang.CharSequence infix)
public static int indexOf(java.lang.CharSequence sequence, java.lang.CharSequence infix)
public static int indexOf(java.lang.CharSequence sequence, java.lang.CharSequence infix, int start)
public static int indexOf(java.lang.CharSequence sequence, java.lang.CharSequence infix, int start, int end)
public static int indexOf(java.lang.CharSequence s, char c, int start, int end, boolean caseSensitive)
public static int indexOf(char [] s, char c, int start, int end, boolean caseSensitive)
public static int indexOfSubstringEnd(java.lang.String text, java.lang.String subString)
public static int indexOfAny(java.lang.String s, java.lang.String chars)
public static int indexOfAny(java.lang.CharSequence s, java.lang.String chars)
public static int indexOfAny(java.lang.String s, java.lang.String chars, int start, int end)
public static int indexOfAny(java.lang.CharSequence s, java.lang.String chars, int start, int end)
public static int lastIndexOfAny(java.lang.CharSequence s, java.lang.String chars)
public static java.lang.String substringBefore(java.lang.String text, java.lang.String subString)
public static java.lang.String substringBeforeLast(java.lang.String text, java.lang.String subString)
public static java.lang.String substringAfter(java.lang.String text, java.lang.String subString)
public static java.lang.String substringAfterLast(java.lang.String text, java.lang.String subString)
public static int lastIndexOf(java.lang.CharSequence s, char c, int start, int end)
[start; end)
sub-sequence of the given text.s
- target textc
- target symbol which last occurrence we want to checkstart
- start offset of the target text (inclusive)end
- end offset of the target text (exclusive)-1
otherwisepublic static java.lang.String first(java.lang.String text, int maxLength, boolean appendEllipsis)
public static java.lang.CharSequence first(java.lang.CharSequence text, int length, boolean appendEllipsis)
public static java.lang.CharSequence last(java.lang.CharSequence text, int length, boolean prependEllipsis)
public static java.lang.String firstLast(java.lang.String text, int length)
public static java.lang.String escapeChar(java.lang.String str, char character)
public static java.lang.String escapeChars(java.lang.String str, char... character)
public static void escapeChar(java.lang.StringBuilder buf, char character)
public static java.lang.String escapeQuotes(java.lang.String str)
public static void escapeQuotes(java.lang.StringBuilder buf)
public static java.lang.String escapeSlashes(java.lang.String str)
public static java.lang.String escapeBackSlashes(java.lang.String str)
public static void escapeSlashes(java.lang.StringBuilder buf)
public static java.lang.String unescapeSlashes(java.lang.String str)
public static java.lang.String unescapeBackSlashes(java.lang.String str)
public static java.lang.String unescapeChar(java.lang.String str, char unescapeChar)
public static void quote(java.lang.StringBuilder builder)
public static void quote(java.lang.StringBuilder builder, char quotingChar)
public static java.lang.String wrapWithDoubleQuote(java.lang.String str)
@Deprecated public static java.lang.String unescapeXml(java.lang.String text)
unescapeXmlEntities(String)
instead@Deprecated public static java.lang.String escapeXml(java.lang.String text)
escapeXmlEntities(String)
insteadpublic static java.lang.String unescapeXmlEntities(java.lang.String text)
text
with some standard XML entities replaced with corresponding characters, e.g. '<
' replaced with '<'public static java.lang.String escapeXmlEntities(java.lang.String text)
text
with some characters replaced with standard XML entities, e.g. '<' replaced with '<
'public static java.lang.String removeHtmlTags(java.lang.String htmlString)
public static java.lang.String removeHtmlTags(java.lang.String htmlString, boolean isRemoveStyleTag)
public static java.lang.String removeEllipsisSuffix(java.lang.String s)
public static java.lang.String escapeMnemonics(java.lang.String text)
public static java.lang.String htmlEmphasize(java.lang.String text)
public static java.lang.String escapeToRegexp(java.lang.String text)
public static java.lang.StringBuilder escapeToRegexp(java.lang.CharSequence text, java.lang.StringBuilder builder)
public static boolean isEscapedBackslash(char [] chars, int startOffset, int backslashOffset)
public static boolean isEscapedBackslash(java.lang.CharSequence text, int startOffset, int backslashOffset)
@Deprecated public static java.lang.String replace(java.lang.String text, java.lang.String [] from, java.lang.String [] to)
replace(String, List, List)
public static java.lang.String replace(java.lang.String text, java.util.List<java.lang.String> from, java.util.List<java.lang.String> to)
public static java.lang.String [] filterEmptyStrings(java.lang.String [] strings)
public static int countNewLines(java.lang.CharSequence text)
public static int countChars(java.lang.CharSequence text, char c)
public static int countChars(java.lang.CharSequence text, char c, int offset, boolean stopAtOtherChar)
public static int countChars(java.lang.CharSequence text, char c, int start, int end, boolean stopAtOtherChar)
public static java.lang.String capitalsOnly(java.lang.String s)
public static java.lang.String joinOrNull(java.lang.String... args)
args
- Strings to join.null
if any of given Strings is null
.public static java.lang.String getPropertyName(java.lang.String methodName)
public static boolean isJavaIdentifierStart(char c)
public static boolean isJavaIdentifierPart(char c)
public static boolean isJavaIdentifier(java.lang.String text)
public static java.lang.String escapeProperty(java.lang.String input, boolean isKey)
input
- an input to escapeisKey
- if true, the rules for key escaping are applied. The leading space is escaped in that case.public static java.lang.String getQualifiedName(java.lang.String packageName, java.lang.String className)
public static int compareVersionNumbers(java.lang.String v1, java.lang.String v2)
public static int getOccurrenceCount(java.lang.String text, char c)
public static int getOccurrenceCount(java.lang.String text, java.lang.String s)
public static int getIgnoreCaseOccurrenceCount(java.lang.String text, java.lang.String s)
public static java.lang.String fixVariableNameDerivedFromPropertyName(java.lang.String name)
public static java.lang.String sanitizeJavaIdentifier(java.lang.String name)
public static void assertValidSeparators(java.lang.CharSequence s)
public static java.lang.String tail(java.lang.String s, int idx)
public static java.lang.String [] splitByLines(java.lang.String string)
string
- String to splitpublic static java.lang.String [] splitByLines(java.lang.String string, boolean excludeEmptyStrings)
excludeEmptyStrings
is false
.string
- String to splitpublic static java.lang.String [] splitByLinesDontTrim(java.lang.String string)
public static java.lang.String [] splitByLinesKeepSeparators(java.lang.String string)
foo\r\nwill return the following array: foo\r\n, \n, bar\n, \r\n, baz\r, \r
\n
bar\n
\r\n
baz\r
\r
public static java.util.List<Pair<java.lang.String,java.lang.Integer>> getWordsWithOffset(java.lang.String s)
public static int naturalCompare(java.lang.String string1, java.lang.String string2)
public static boolean isDecimalDigit(char c)
public static boolean isNotNegativeNumber(java.lang.CharSequence s)
public static int compare(java.lang.String s1, java.lang.String s2, boolean ignoreCase)
public static int compare(java.lang.CharSequence s1, java.lang.CharSequence s2, boolean ignoreCase)
public static int comparePairs(java.lang.String s1, java.lang.String t1, java.lang.String s2, java.lang.String t2, boolean ignoreCase)
public static boolean equals(java.lang.CharSequence s1, java.lang.CharSequence s2)
public static boolean equalsIgnoreCase(java.lang.CharSequence s1, java.lang.CharSequence s2)
public static boolean equalsIgnoreWhitespaces(java.lang.CharSequence s1, java.lang.CharSequence s2)
public static boolean equalsTrimWhitespaces(java.lang.CharSequence s1, java.lang.CharSequence s2)
public static java.lang.String collapseWhiteSpace(java.lang.CharSequence s)
public static boolean findIgnoreCase(java.lang.String toFind, java.lang.String... where)
public static int compare(char c1, char c2, boolean ignoreCase)
public static boolean charsMatch(char c1, char c2, boolean ignoreCase)
public static java.lang.String formatLinks(java.lang.String message)
public static boolean isHexDigit(char c)
public static boolean isOctalDigit(char c)
public static java.lang.String shortenTextWithEllipsis(java.lang.String text, int maxLength, int suffixLength)
public static java.lang.String trimMiddle(java.lang.String text, int maxLength)
public static java.lang.String shortenTextWithEllipsis(java.lang.String text, int maxLength, int suffixLength, java.lang.String symbol)
public static java.lang.String shortenTextWithEllipsis(java.lang.String text, int maxLength, int suffixLength, boolean useEllipsisSymbol)
public static java.lang.String shortenPathWithEllipsis(java.lang.String path, int maxLength, boolean useEllipsisSymbol)
public static java.lang.String shortenPathWithEllipsis(java.lang.String path, int maxLength)
public static boolean charsEqualIgnoreCase(char a, char b)
public static char toUpperCase(char a)
public static java.lang.String toUpperCase(java.lang.String s)
public static char toLowerCase(char a)
public static boolean isUpperCase(java.lang.CharSequence sequence)
public static LineSeparator detectSeparators(java.lang.CharSequence text)
public static LineSeparator getLineSeparatorAt(java.lang.CharSequence text, int index)
public static java.lang.String convertLineSeparators(java.lang.String text)
public static java.lang.String convertLineSeparators(java.lang.String text, boolean keepCarriageReturn)
public static java.lang.String convertLineSeparators(java.lang.String text, java.lang.String newSeparator)
public static java.lang.String convertLineSeparators(java.lang.String text, java.lang.String newSeparator, int [] offsetsToKeep)
public static int parseInt(java.lang.String string, int defaultValue)
public static long parseLong(java.lang.String string, long defaultValue)
public static double parseDouble(java.lang.String string, double defaultValue)
public static <E extends java.lang.Enum<E>> E parseEnum(java.lang.String string, E defaultValue, java.lang.Class<E> clazz)
public static java.lang.String getShortName(java.lang.Class<?> aClass)
public static java.lang.String getShortName(java.lang.String fqName)
public static java.lang.String getShortName(java.lang.String fqName, char separator)
public static boolean isShortNameOf(java.lang.String fqName, java.lang.String shortName)
getShortName(fqName).equals(shortName)
, but could be faster.fqName
- fully-qualified name (dot-separated)shortName
- a short name, must not contain dotspublic static java.lang.CharSequence newBombedCharSequence(java.lang.CharSequence sequence, long delay)
public static boolean trimEnd(java.lang.StringBuilder buffer, java.lang.CharSequence end)
public static boolean isBetween(java.lang.String string, java.lang.String smallPart, java.lang.String bigPart)
public static boolean hasUpperCaseChar(java.lang.String s)
s
- the string to test.public static boolean hasLowerCaseChar(java.lang.String s)
s
- the string to test.public static java.lang.String replaceUnicodeEscapeSequences(java.lang.String text)
public static java.lang.String toHexString(byte [] bytes)
public static byte [] parseHexString(java.lang.String str)
@Deprecated public static boolean startsWithConcatenationOf(java.lang.String string, java.lang.String firstPrefix, java.lang.String secondPrefix)
startsWithConcatenation(String, String...)
public static boolean isLatinAlphanumeric(java.lang.CharSequence str)
true
if the passed string is not null
and not empty
and contains only latin upper- or lower-case characters and digits; false
otherwise.public static java.lang.String internEmptyString(java.lang.String s)
public static int skipWhitespaceForward(java.lang.CharSequence text, int pos)
text
- textpos
- starting positionpublic static int skipWhitespaceBackward(java.lang.CharSequence text, int pos)
text
- textpos
- starting position