Class StringIterate
- java.lang.Object
-
- org.eclipse.collections.impl.utility.StringIterate
-
public final class StringIterate extends java.lang.Object
A string is essentially an array of characters. In Smalltalk a String is a subclass of ArrayedCollection, which means it supports the Collection protocol. StringIterate implements the methods available on the collection protocol that make sense for Strings. Some methods are over-specialized, in the form of englishToUppercase() which is a fast form of uppercase, but does not work for different locales.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
StringIterate.AddCharacterToCollection
private static class
StringIterate.AddLowercaseCharacterToCollection
private static class
StringIterate.AddUppercaseCharacterToCollection
-
Constructor Summary
Constructors Modifier Constructor Description private
StringIterate()
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static boolean
allSatisfy(java.lang.String string, CharPredicate predicate)
Deprecated.since 7.0.static boolean
allSatisfy(java.lang.String string, CodePointPredicate predicate)
Deprecated.since 7.0.static boolean
allSatisfyChar(java.lang.String string, CharPredicate predicate)
static boolean
allSatisfyCodePoint(java.lang.String string, CodePointPredicate predicate)
static boolean
anySatisfy(java.lang.String string, CharPredicate predicate)
Deprecated.since 7.0.static boolean
anySatisfy(java.lang.String string, CodePointPredicate predicate)
Deprecated.since 7.0.static boolean
anySatisfyChar(java.lang.String string, CharPredicate predicate)
static boolean
anySatisfyCodePoint(java.lang.String string, CodePointPredicate predicate)
static CharAdapter
asCharAdapter(java.lang.String string)
static CodePointAdapter
asCodePointAdapter(java.lang.String string)
static MutableSet<java.lang.Character>
asLowercaseSet(java.lang.String string)
Deprecated.in 3.0.static MutableSet<java.lang.Character>
asUppercaseSet(java.lang.String string)
Deprecated.in 3.0.private static boolean
charactersSatisfy(java.lang.String string, CodePointPredicate predicate)
static MutableList<java.lang.String>
chunk(java.lang.String string, int size)
Partitions String in fixed size chunks.static java.lang.String
collect(java.lang.String string, CharToCharFunction function)
Deprecated.since 7.0.static java.lang.String
collect(java.lang.String string, CharFunction function)
Deprecated.since 3.0.static java.lang.String
collect(java.lang.String string, CodePointFunction function)
Deprecated.since 7.0.static java.lang.String
collectChar(java.lang.String string, CharToCharFunction function)
Transform the char elements to a new string using the specified functionfunction
.static java.lang.String
collectCodePoint(java.lang.String string, CodePointFunction function)
Transform the int code point elements to a new string using the specified functionfunction
.static int
count(java.lang.String string, CharPredicate predicate)
Deprecated.since 7.0.static int
count(java.lang.String string, CodePointPredicate predicate)
Deprecated.since 7.0.static int
count(java.lang.String string, CharPredicate predicate)
Deprecated.since 3.0.static int
countChar(java.lang.String string, CharPredicate predicate)
Count the number of elements that return true for the specifiedpredicate
.static int
countCodePoint(java.lang.String string, CodePointPredicate predicate)
Count the number of elements that return true for the specifiedpredicate
.static MutableList<java.lang.String>
csvTokensToList(java.lang.String string)
Deprecated.in 3.0.static MutableList<java.lang.String>
csvTokensToReverseSortedList(java.lang.String string)
Deprecated.in 3.0.static MutableSet<java.lang.String>
csvTokensToSet(java.lang.String string)
Deprecated.in 3.0.static MutableList<java.lang.String>
csvTokensToSortedList(java.lang.String string)
Deprecated.in 3.0.static MutableList<java.lang.String>
csvTrimmedTokensToList(java.lang.String string)
Deprecated.in 3.0.static MutableList<java.lang.String>
csvTrimmedTokensToSortedList(java.lang.String string)
Deprecated.in 3.0.static java.lang.Character
detect(java.lang.String string, CharPredicate predicate)
Deprecated.since 7.0.static java.lang.Character
detectChar(java.lang.String string, CharPredicate predicate)
Find the first element that returns true for the specifiedpredicate
.static java.lang.Character
detectCharIfNone(java.lang.String string, CharPredicate predicate, char resultIfNone)
Find the first element that returns true for the specifiedpredicate
.static java.lang.Character
detectCharIfNone(java.lang.String string, CharPredicate predicate, java.lang.String resultIfNone)
Find the first element that returns true for the specifiedpredicate
.static java.lang.Character
detectIfNone(java.lang.String string, CharPredicate predicate, char resultIfNone)
Deprecated.since 7.0.static java.lang.Character
detectIfNone(java.lang.String string, CharPredicate predicate, java.lang.String resultIfNone)
Deprecated.since 7.0.static java.lang.String
englishToLowerCase(java.lang.String string)
static java.lang.String
englishToUpperCase(java.lang.String string)
static void
forEach(java.lang.String string, CharProcedure procedure)
Deprecated.since 7.0.static void
forEach(java.lang.String string, CharProcedure procedure)
Deprecated.since 3.0.static void
forEach(java.lang.String string, CodePointProcedure procedure)
Deprecated.since 7.0.static void
forEachChar(java.lang.String string, CharProcedure procedure)
For each char in thestring
, execute theCharProcedure
.static void
forEachCodePoint(java.lang.String string, CodePointProcedure procedure)
For each int code point in thestring
, execute theCodePointProcedure
.static void
forEachToken(java.lang.String string, java.lang.String separator, Procedure<java.lang.String> procedure)
For each token in a string separated by the specified separator, execute the specified StringProcedure by calling the valueOfString method.static void
forEachTrimmedToken(java.lang.String string, java.lang.String separator, Procedure<java.lang.String> procedure)
static java.lang.String
getFirstToken(java.lang.String value, java.lang.String separator)
static java.lang.String
getLastToken(java.lang.String value, java.lang.String separator)
static <T,R>
RinjectIntoTokens(java.lang.String string, java.lang.String separator, R injectedValue, Function2<? super R,java.lang.String,? extends R> function)
For each token in a string separated by the specified separator, execute the specified Function2, returning the result value from the function.static boolean
isAlphaNumeric(java.lang.String string)
static boolean
isEmpty(java.lang.String string)
static boolean
isEmptyOrWhitespace(java.lang.String string)
static boolean
isNumber(java.lang.String string)
static boolean
isSurrogate(java.lang.String string, int i)
private static boolean
isWhitespace(java.lang.String string)
private static int
lastIndex(java.lang.String string)
static boolean
noneSatisfy(java.lang.String string, CharPredicate predicate)
Deprecated.since 7.0.static boolean
noneSatisfy(java.lang.String string, CodePointPredicate predicate)
Deprecated.since 7.0.static boolean
noneSatisfyChar(java.lang.String string, CharPredicate predicate)
static boolean
noneSatisfyCodePoint(java.lang.String string, CodePointPredicate predicate)
static boolean
notEmpty(java.lang.String string)
static boolean
notEmptyOrWhitespace(java.lang.String string)
static int
numberOfChars(java.lang.String string, int i)
static int
occurrencesOf(java.lang.String string, char value)
Deprecated.since 7.0.static int
occurrencesOf(java.lang.String string, int value)
Deprecated.since 7.0.static int
occurrencesOf(java.lang.String string, java.lang.String singleCharacter)
Count the number of occurrences of the specifiedstring
.static int
occurrencesOfChar(java.lang.String string, char value)
Count the number of occurrences of the specified char.static int
occurrencesOfCodePoint(java.lang.String string, int value)
Count the number of occurrences of the specified int code point.static java.lang.String
padOrTrim(java.lang.String message, int targetLength)
static java.lang.String
reject(java.lang.String string, CharPredicate predicate)
Deprecated.since 7.0.static java.lang.String
reject(java.lang.String string, CodePointPredicate predicate)
Deprecated.since 7.0.static java.lang.String
rejectChar(java.lang.String string, CharPredicate predicate)
static java.lang.String
rejectCodePoint(java.lang.String string, CodePointPredicate predicate)
static java.lang.String
repeat(char c, int repeatTimes)
static java.lang.String
repeat(java.lang.String template, int repeatTimes)
static void
reverseForEach(java.lang.String string, CharProcedure procedure)
Deprecated.since 7.0.static void
reverseForEach(java.lang.String string, CodePointProcedure procedure)
Deprecated.since 7.0.static void
reverseForEachChar(java.lang.String string, CharProcedure procedure)
For each char in thestring
in reverse order, execute theCharProcedure
.static void
reverseForEachCodePoint(java.lang.String string, CodePointProcedure procedure)
For each int code point in thestring
in reverse order, execute theCodePointProcedure
.static java.lang.String
select(java.lang.String string, CharPredicate predicate)
Deprecated.since 7.0.static java.lang.String
select(java.lang.String string, CodePointPredicate predicate)
Deprecated.since 7.0.static java.lang.String
selectChar(java.lang.String string, CharPredicate predicate)
static java.lang.String
selectCodePoint(java.lang.String string, CodePointPredicate predicate)
static Twin<java.lang.String>
splitAtIndex(java.lang.String aString, int index)
static MutableBag<java.lang.Character>
toBag(java.lang.String string)
static CodePointList
toCodePointList(java.lang.String string)
static MutableList<java.lang.String>
tokensToList(java.lang.String string, java.lang.String separator)
Converts a string of tokens separated by the specified separator to aMutableList
.static MutableMap<java.lang.String,java.lang.String>
tokensToMap(java.lang.String string)
Converts a string of tokens to aMutableMap
using a | to separate pairs, and a : to separate key and value.static MutableMap<java.lang.String,java.lang.String>
tokensToMap(java.lang.String string, java.lang.String pairSeparator, java.lang.String keyValueSeparator)
Converts a string of tokens to aMutableMap
using the specified separators.static <K,V>
MutableMap<K,V>tokensToMap(java.lang.String string, java.lang.String separator, java.lang.String keyValueSeparator, Function<java.lang.String,K> keyFunction, Function<java.lang.String,V> valueFunction)
Converts a string of tokens to aMutableMap
using the specified 'key' and 'value' Functions.static MutableList<java.lang.String>
tokensToReverseSortedList(java.lang.String string, java.lang.String separator)
Converts a string of tokens separated by the specified separator to a reverse sortedMutableList
.static MutableSet<java.lang.String>
tokensToSet(java.lang.String string, java.lang.String separator)
Converts a string of tokens to aMutableSet
.static MutableList<java.lang.String>
tokensToSortedList(java.lang.String string, java.lang.String separator)
Converts a string of tokens separated by the specified separator to a sortedMutableList
.static MutableList<java.lang.Character>
toList(java.lang.String string)
static MutableBag<java.lang.Character>
toLowercaseBag(java.lang.String string)
static MutableList<java.lang.Character>
toLowercaseList(java.lang.String string)
static MutableSet<java.lang.Character>
toLowercaseSet(java.lang.String string)
static MutableSet<java.lang.Character>
toSet(java.lang.String string)
static MutableBag<java.lang.Character>
toUppercaseBag(java.lang.String string)
static MutableList<java.lang.Character>
toUppercaseList(java.lang.String string)
static MutableSet<java.lang.Character>
toUppercaseSet(java.lang.String string)
static MutableList<java.lang.String>
trimmedTokensToList(java.lang.String string, java.lang.String separator)
Converts a string of tokens separated by the specified separator to aMutableList
.static MutableList<java.lang.String>
trimmedTokensToSortedList(java.lang.String string, java.lang.String separator)
Converts a string of tokens separated by the specified separator to a sortedMutableList
.private static <L extends java.util.List<java.lang.String>>
LtrimStringList(L strings)
AppliesString.trim()
to each String in theList
-
-
-
Method Detail
-
asCharAdapter
public static CharAdapter asCharAdapter(java.lang.String string)
- Since:
- 7.0.
-
asCodePointAdapter
public static CodePointAdapter asCodePointAdapter(java.lang.String string)
- Since:
- 7.0.
-
toCodePointList
public static CodePointList toCodePointList(java.lang.String string)
- Since:
- 7.0.
-
csvTokensToSortedList
@Deprecated public static MutableList<java.lang.String> csvTokensToSortedList(java.lang.String string)
Deprecated.in 3.0. Inlineable. Poorly named method. Does not actually deal properly with CSV. This is better handled in a separate library.Converts a string of tokens separated by the specified separator to a sortedMutableList
.
-
csvTrimmedTokensToSortedList
@Deprecated public static MutableList<java.lang.String> csvTrimmedTokensToSortedList(java.lang.String string)
Deprecated.in 3.0. Inlineable. Poorly named method. Does not actually deal properly with CSV. This is better handled in a separate library.Converts a string of tokens separated by the specified separator to a sortedMutableList
.
-
tokensToSortedList
public static MutableList<java.lang.String> tokensToSortedList(java.lang.String string, java.lang.String separator)
Converts a string of tokens separated by the specified separator to a sortedMutableList
.
-
trimmedTokensToSortedList
public static MutableList<java.lang.String> trimmedTokensToSortedList(java.lang.String string, java.lang.String separator)
Converts a string of tokens separated by the specified separator to a sortedMutableList
.
-
csvTokensToList
@Deprecated public static MutableList<java.lang.String> csvTokensToList(java.lang.String string)
Deprecated.in 3.0. Inlineable. Poorly named method. Does not actually deal properly with CSV. This is better handled in a separate library.Converts a string of tokens separated by commas to aMutableList
.
-
csvTrimmedTokensToList
@Deprecated public static MutableList<java.lang.String> csvTrimmedTokensToList(java.lang.String string)
Deprecated.in 3.0. Inlineable. Poorly named method. Does not actually deal properly with CSV. This is better handled in a separate library.Converts a string of tokens separated by commas to aMutableList
.
-
tokensToList
public static MutableList<java.lang.String> tokensToList(java.lang.String string, java.lang.String separator)
Converts a string of tokens separated by the specified separator to aMutableList
.
-
trimmedTokensToList
public static MutableList<java.lang.String> trimmedTokensToList(java.lang.String string, java.lang.String separator)
Converts a string of tokens separated by the specified separator to aMutableList
.
-
trimStringList
private static <L extends java.util.List<java.lang.String>> L trimStringList(L strings)
AppliesString.trim()
to each String in theList
- Returns:
- the input list, mutated in place, containing trimmed strings.
-
csvTokensToSet
@Deprecated public static MutableSet<java.lang.String> csvTokensToSet(java.lang.String string)
Deprecated.in 3.0. Inlineable. Poorly named method. Does not actually deal properly with CSV. This is better handled in a separate library.Converts a string of tokens separated by commas to aMutableSet
.
-
tokensToSet
public static MutableSet<java.lang.String> tokensToSet(java.lang.String string, java.lang.String separator)
Converts a string of tokens to aMutableSet
.
-
tokensToMap
public static MutableMap<java.lang.String,java.lang.String> tokensToMap(java.lang.String string)
Converts a string of tokens to aMutableMap
using a | to separate pairs, and a : to separate key and value. e.g. "1:Sunday|2:Monday|3:Tuesday|4:Wednesday|5:Thursday|6:Friday|7:Saturday"
-
tokensToMap
public static MutableMap<java.lang.String,java.lang.String> tokensToMap(java.lang.String string, java.lang.String pairSeparator, java.lang.String keyValueSeparator)
Converts a string of tokens to aMutableMap
using the specified separators.
-
tokensToMap
public static <K,V> MutableMap<K,V> tokensToMap(java.lang.String string, java.lang.String separator, java.lang.String keyValueSeparator, Function<java.lang.String,K> keyFunction, Function<java.lang.String,V> valueFunction)
Converts a string of tokens to aMutableMap
using the specified 'key' and 'value' Functions. e.g. "1:2,2:1,3:3" with both functions as Functions.getStringToInteger(), will be translated a map {[1,2],[2,1],[3,3]}
-
csvTokensToReverseSortedList
@Deprecated public static MutableList<java.lang.String> csvTokensToReverseSortedList(java.lang.String string)
Deprecated.in 3.0. Inlineable. Poorly named method. Does not actually deal properly with CSV. This is better handled in a separate library.Converts a string of tokens separated by the specified separator to a reverse sortedMutableList
.
-
tokensToReverseSortedList
public static MutableList<java.lang.String> tokensToReverseSortedList(java.lang.String string, java.lang.String separator)
Converts a string of tokens separated by the specified separator to a reverse sortedMutableList
.
-
forEachToken
public static void forEachToken(java.lang.String string, java.lang.String separator, Procedure<java.lang.String> procedure)
For each token in a string separated by the specified separator, execute the specified StringProcedure by calling the valueOfString method.
-
injectIntoTokens
public static <T,R> R injectIntoTokens(java.lang.String string, java.lang.String separator, R injectedValue, Function2<? super R,java.lang.String,? extends R> function)
For each token in a string separated by the specified separator, execute the specified Function2, returning the result value from the function. For more information, seeIterate.injectInto(Object, Iterable, Function2)
-
forEachTrimmedToken
public static void forEachTrimmedToken(java.lang.String string, java.lang.String separator, Procedure<java.lang.String> procedure)
-
forEach
@Deprecated public static void forEach(java.lang.String string, CharProcedure procedure)
Deprecated.since 3.0. UseforEach(String, CharProcedure)
instead.For each character in thestring
, execute theCharProcedure
.
-
forEach
@Deprecated public static void forEach(java.lang.String string, CharProcedure procedure)
Deprecated.since 7.0. UseforEachChar(String, CharProcedure)
instead.For each character in thestring
, execute theCharProcedure
.
-
forEachChar
public static void forEachChar(java.lang.String string, CharProcedure procedure)
For each char in thestring
, execute theCharProcedure
.- Since:
- 7.0
-
forEach
@Deprecated public static void forEach(java.lang.String string, CodePointProcedure procedure)
Deprecated.since 7.0. UseforEachCodePoint(String, CodePointProcedure)
instead.For each int code point in thestring
, execute theCodePointProcedure
.
-
forEachCodePoint
public static void forEachCodePoint(java.lang.String string, CodePointProcedure procedure)
For each int code point in thestring
, execute theCodePointProcedure
.- Since:
- 7.0
-
reverseForEach
@Deprecated public static void reverseForEach(java.lang.String string, CharProcedure procedure)
Deprecated.since 7.0. UsereverseForEachChar(String, CharProcedure)
instead.For each char in thestring
in reverse order, execute theCharProcedure
.
-
reverseForEachChar
public static void reverseForEachChar(java.lang.String string, CharProcedure procedure)
For each char in thestring
in reverse order, execute theCharProcedure
.- Since:
- 7.0
-
reverseForEach
@Deprecated public static void reverseForEach(java.lang.String string, CodePointProcedure procedure)
Deprecated.since 7.0. UsereverseForEachCodePoint(String, CodePointProcedure)
instead.For each int code point in thestring
in reverse order, execute theCodePointProcedure
.
-
reverseForEachCodePoint
public static void reverseForEachCodePoint(java.lang.String string, CodePointProcedure procedure)
For each int code point in thestring
in reverse order, execute theCodePointProcedure
.- Since:
- 7.0
-
lastIndex
private static int lastIndex(java.lang.String string)
-
numberOfChars
public static int numberOfChars(java.lang.String string, int i)
-
isSurrogate
public static boolean isSurrogate(java.lang.String string, int i)
-
count
@Deprecated public static int count(java.lang.String string, CharPredicate predicate)
Deprecated.since 3.0.Count the number of elements that return true for the specifiedpredicate
.
-
count
@Deprecated public static int count(java.lang.String string, CharPredicate predicate)
Deprecated.since 7.0. UsecountChar(String, CharPredicate)
instead.Count the number of elements that return true for the specifiedpredicate
.
-
countChar
public static int countChar(java.lang.String string, CharPredicate predicate)
Count the number of elements that return true for the specifiedpredicate
.- Since:
- 7.0
-
count
@Deprecated public static int count(java.lang.String string, CodePointPredicate predicate)
Deprecated.since 7.0. UsecountCodePoint(String, CodePointPredicate)
instead.Count the number of elements that return true for the specifiedpredicate
.
-
countCodePoint
public static int countCodePoint(java.lang.String string, CodePointPredicate predicate)
Count the number of elements that return true for the specifiedpredicate
.- Since:
- 7.0
-
collect
@Deprecated public static java.lang.String collect(java.lang.String string, CharFunction function)
Deprecated.since 3.0. Usecollect(String, CharToCharFunction)
instead.
-
collect
@Deprecated public static java.lang.String collect(java.lang.String string, CharToCharFunction function)
Deprecated.since 7.0. UsecollectChar(String, CharToCharFunction)
instead.Transform the char elements to a new string using the specified functionfunction
.
-
collectChar
public static java.lang.String collectChar(java.lang.String string, CharToCharFunction function)
Transform the char elements to a new string using the specified functionfunction
.- Since:
- 7.0
-
collect
@Deprecated public static java.lang.String collect(java.lang.String string, CodePointFunction function)
Deprecated.since 7.0. UsecollectCodePoint(String, CodePointFunction)
instead.Transform the int code point elements to a new string using the specified functionfunction
.
-
collectCodePoint
public static java.lang.String collectCodePoint(java.lang.String string, CodePointFunction function)
Transform the int code point elements to a new string using the specified functionfunction
.- Since:
- 7.0
-
englishToUpperCase
public static java.lang.String englishToUpperCase(java.lang.String string)
-
englishToLowerCase
public static java.lang.String englishToLowerCase(java.lang.String string)
-
detect
@Deprecated public static java.lang.Character detect(java.lang.String string, CharPredicate predicate)
Deprecated.since 7.0. UsedetectChar(String, CharPredicate)
instead.Find the first element that returns true for the specifiedpredicate
.
-
detectChar
public static java.lang.Character detectChar(java.lang.String string, CharPredicate predicate)
Find the first element that returns true for the specifiedpredicate
.- Since:
- 7.0
-
detectIfNone
@Deprecated public static java.lang.Character detectIfNone(java.lang.String string, CharPredicate predicate, char resultIfNone)
Deprecated.since 7.0. UsedetectCharIfNone(String, CharPredicate, char)
instead.Find the first element that returns true for the specifiedpredicate
. Return the default char if no value is found.
-
detectCharIfNone
public static java.lang.Character detectCharIfNone(java.lang.String string, CharPredicate predicate, char resultIfNone)
Find the first element that returns true for the specifiedpredicate
. Return the default char if no value is found.
-
detectIfNone
@Deprecated public static java.lang.Character detectIfNone(java.lang.String string, CharPredicate predicate, java.lang.String resultIfNone)
Deprecated.since 7.0. UsedetectCharIfNone(String, CharPredicate, String)
instead.Find the first element that returns true for the specifiedpredicate
. Return the first char of the default string if no value is found.
-
detectCharIfNone
public static java.lang.Character detectCharIfNone(java.lang.String string, CharPredicate predicate, java.lang.String resultIfNone)
Find the first element that returns true for the specifiedpredicate
. Return the first char of the default string if no value is found.
-
occurrencesOf
@Deprecated public static int occurrencesOf(java.lang.String string, char value)
Deprecated.since 7.0. UseoccurrencesOfChar(String, char)
instead.Count the number of occurrences of the specified char.
-
occurrencesOfChar
public static int occurrencesOfChar(java.lang.String string, char value)
Count the number of occurrences of the specified char.- Since:
- 7.0
-
occurrencesOf
@Deprecated public static int occurrencesOf(java.lang.String string, int value)
Deprecated.since 7.0. UseoccurrencesOfCodePoint(String, int)
instead.Count the number of occurrences of the specified int code point.
-
occurrencesOfCodePoint
public static int occurrencesOfCodePoint(java.lang.String string, int value)
Count the number of occurrences of the specified int code point.- Since:
- 7.0
-
occurrencesOf
public static int occurrencesOf(java.lang.String string, java.lang.String singleCharacter)
Count the number of occurrences of the specifiedstring
.
-
anySatisfy
@Deprecated public static boolean anySatisfy(java.lang.String string, CharPredicate predicate)
Deprecated.since 7.0. UseanySatisfyChar(String, CharPredicate)
instead.- Returns:
- true if any of the characters in the
string
answer true for the specifiedpredicate
.
-
anySatisfyChar
public static boolean anySatisfyChar(java.lang.String string, CharPredicate predicate)
- Returns:
- true if any of the characters in the
string
answer true for the specifiedpredicate
. - Since:
- 7.0
-
anySatisfy
@Deprecated public static boolean anySatisfy(java.lang.String string, CodePointPredicate predicate)
Deprecated.since 7.0. UseanySatisfyCodePoint(String, CodePointPredicate)
instead.- Returns:
- true if any of the code points in the
string
answer true for the specifiedpredicate
.
-
anySatisfyCodePoint
public static boolean anySatisfyCodePoint(java.lang.String string, CodePointPredicate predicate)
- Returns:
- true if any of the code points in the
string
answer true for the specifiedpredicate
. - Since:
- 7.0
-
allSatisfy
@Deprecated public static boolean allSatisfy(java.lang.String string, CharPredicate predicate)
Deprecated.since 7.0. UseallSatisfyChar(String, CharPredicate)
instead.- Returns:
- true if all the characters in the
string
answer true for the specifiedpredicate
.
-
allSatisfyChar
public static boolean allSatisfyChar(java.lang.String string, CharPredicate predicate)
- Returns:
- true if all the characters in the
string
answer true for the specifiedpredicate
. - Since:
- 7.0
-
allSatisfy
@Deprecated public static boolean allSatisfy(java.lang.String string, CodePointPredicate predicate)
Deprecated.since 7.0. UseallSatisfyCodePoint(String, CodePointPredicate)
instead.- Returns:
- true if all the code points in the
string
answer true for the specifiedpredicate
.
-
allSatisfyCodePoint
public static boolean allSatisfyCodePoint(java.lang.String string, CodePointPredicate predicate)
- Returns:
- true if all the code points in the
string
answer true for the specifiedpredicate
. - Since:
- 7.0
-
noneSatisfy
@Deprecated public static boolean noneSatisfy(java.lang.String string, CharPredicate predicate)
Deprecated.since 7.0. UsenoneSatisfyChar(String, CharPredicate)
instead.- Returns:
- true if none of the characters in the
string
answer true for the specifiedpredicate
.
-
noneSatisfyChar
public static boolean noneSatisfyChar(java.lang.String string, CharPredicate predicate)
- Returns:
- true if none of the characters in the
string
answer true for the specifiedpredicate
. - Since:
- 7.0
-
noneSatisfy
@Deprecated public static boolean noneSatisfy(java.lang.String string, CodePointPredicate predicate)
Deprecated.since 7.0. UsenoneSatisfyCodePoint(String, CodePointPredicate)
instead.- Returns:
- true if none of the code points in the
string
answer true for the specifiedpredicate
.
-
noneSatisfyCodePoint
public static boolean noneSatisfyCodePoint(java.lang.String string, CodePointPredicate predicate)
- Returns:
- true if none of the code points in the
string
answer true for the specifiedpredicate
. - Since:
- 7.0
-
select
@Deprecated public static java.lang.String select(java.lang.String string, CharPredicate predicate)
Deprecated.since 7.0. UseselectChar(String, CharPredicate)
instead.- Returns:
- a new string with all the characters that return true for the specified
predicate
.
-
selectChar
public static java.lang.String selectChar(java.lang.String string, CharPredicate predicate)
- Returns:
- a new string with all the characters that return true for the specified
predicate
. - Since:
- 7.0
-
select
@Deprecated public static java.lang.String select(java.lang.String string, CodePointPredicate predicate)
Deprecated.since 7.0. UseselectCodePoint(String, CodePointPredicate)
instead.- Returns:
- a new string with all the code points that return true for the specified
predicate
.
-
selectCodePoint
public static java.lang.String selectCodePoint(java.lang.String string, CodePointPredicate predicate)
- Returns:
- a new string with all the code points that return true for the specified
predicate
. - Since:
- 7.0
-
reject
@Deprecated public static java.lang.String reject(java.lang.String string, CharPredicate predicate)
Deprecated.since 7.0. UserejectChar(String, CharPredicate)
instead.- Returns:
- a new string excluding all the characters that return true for the specified
predicate
.
-
rejectChar
public static java.lang.String rejectChar(java.lang.String string, CharPredicate predicate)
- Returns:
- a new string excluding all the characters that return true for the specified
predicate
. - Since:
- 7.0
-
reject
@Deprecated public static java.lang.String reject(java.lang.String string, CodePointPredicate predicate)
Deprecated.since 7.0. UserejectCodePoint(String, CodePointPredicate)
instead.- Returns:
- a new string excluding all the code points that return true for the specified
predicate
.
-
rejectCodePoint
public static java.lang.String rejectCodePoint(java.lang.String string, CodePointPredicate predicate)
- Returns:
- a new string excluding all the code points that return true for the specified
predicate
. - Since:
- 7.0
-
getLastToken
public static java.lang.String getLastToken(java.lang.String value, java.lang.String separator)
-
getFirstToken
public static java.lang.String getFirstToken(java.lang.String value, java.lang.String separator)
-
isEmpty
public static boolean isEmpty(java.lang.String string)
-
isEmptyOrWhitespace
public static boolean isEmptyOrWhitespace(java.lang.String string)
-
isWhitespace
private static boolean isWhitespace(java.lang.String string)
-
isNumber
public static boolean isNumber(java.lang.String string)
-
isAlphaNumeric
public static boolean isAlphaNumeric(java.lang.String string)
-
charactersSatisfy
private static boolean charactersSatisfy(java.lang.String string, CodePointPredicate predicate)
-
notEmpty
public static boolean notEmpty(java.lang.String string)
-
notEmptyOrWhitespace
public static boolean notEmptyOrWhitespace(java.lang.String string)
-
repeat
public static java.lang.String repeat(java.lang.String template, int repeatTimes)
-
repeat
public static java.lang.String repeat(char c, int repeatTimes)
-
padOrTrim
public static java.lang.String padOrTrim(java.lang.String message, int targetLength)
-
toList
public static MutableList<java.lang.Character> toList(java.lang.String string)
-
toLowercaseList
public static MutableList<java.lang.Character> toLowercaseList(java.lang.String string)
-
toUppercaseList
public static MutableList<java.lang.Character> toUppercaseList(java.lang.String string)
-
toBag
public static MutableBag<java.lang.Character> toBag(java.lang.String string)
-
toLowercaseBag
public static MutableBag<java.lang.Character> toLowercaseBag(java.lang.String string)
-
toUppercaseBag
public static MutableBag<java.lang.Character> toUppercaseBag(java.lang.String string)
-
toSet
public static MutableSet<java.lang.Character> toSet(java.lang.String string)
-
chunk
public static MutableList<java.lang.String> chunk(java.lang.String string, int size)
Partitions String in fixed size chunks.- Parameters:
size
- the number of characters per chunk- Returns:
- A
MutableList
containingString
s of sizesize
, except the last will be truncated (i.e. shorter) if the characters don't divide evenly. - Since:
- 5.2
-
asUppercaseSet
@Deprecated public static MutableSet<java.lang.Character> asUppercaseSet(java.lang.String string)
Deprecated.in 3.0. Inlineable.
-
toUppercaseSet
public static MutableSet<java.lang.Character> toUppercaseSet(java.lang.String string)
-
asLowercaseSet
@Deprecated public static MutableSet<java.lang.Character> asLowercaseSet(java.lang.String string)
Deprecated.in 3.0. Inlineable.
-
toLowercaseSet
public static MutableSet<java.lang.Character> toLowercaseSet(java.lang.String string)
-
splitAtIndex
public static Twin<java.lang.String> splitAtIndex(java.lang.String aString, int index)
-
-