public final class StringIterate extends Object
Modifier and Type | Method and Description |
---|---|
static boolean |
allSatisfy(String string,
CharPredicate predicate) |
static boolean |
allSatisfy(String string,
CodePointPredicate predicate) |
static boolean |
anySatisfy(String string,
CharPredicate predicate) |
static boolean |
anySatisfy(String string,
CodePointPredicate predicate) |
static MutableSet<Character> |
asLowercaseSet(String string)
Deprecated.
in 3.0. Inlineable.
|
static MutableSet<Character> |
asUppercaseSet(String string)
Deprecated.
in 3.0. Inlineable.
|
static String |
collect(String string,
CharFunction function)
Deprecated.
since 3.0. Use
collect(String, CharToCharFunction) instead. |
static String |
collect(String string,
CharToCharFunction function) |
static String |
collect(String string,
CodePointFunction function) |
static int |
count(String string,
CharPredicate predicate)
Deprecated.
since 3.0.
|
static int |
count(String string,
CharPredicate predicate)
Count the number of elements that return true for the specified
predicate . |
static int |
count(String string,
CodePointPredicate predicate)
Count the number of elements that return true for the specified
predicate . |
static MutableList<String> |
csvTokensToList(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.
|
static MutableList<String> |
csvTokensToReverseSortedList(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.
|
static MutableSet<String> |
csvTokensToSet(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.
|
static MutableList<String> |
csvTokensToSortedList(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.
|
static MutableList<String> |
csvTrimmedTokensToList(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.
|
static MutableList<String> |
csvTrimmedTokensToSortedList(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.
|
static Character |
detect(String string,
CharPredicate predicate)
Find the first element that returns true for the specified
predicate . |
static Character |
detectIfNone(String string,
CharPredicate predicate,
char resultIfNone)
Find the first element that returns true for the specified
predicate . |
static Character |
detectIfNone(String string,
CharPredicate predicate,
String resultIfNone)
Find the first element that returns true for the specified
predicate . |
static String |
englishToLowerCase(String string) |
static String |
englishToUpperCase(String string) |
static void |
forEach(String string,
CharProcedure procedure)
Deprecated.
since 3.0. Use
forEach(String, CharProcedure) instead. |
static void |
forEach(String string,
CharProcedure procedure)
For each character in the
string , execute the CharProcedure . |
static void |
forEach(String string,
CodePointProcedure procedure)
For each character in the
string , execute the CodePointProcedure . |
static void |
forEachToken(String string,
String separator,
Procedure<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(String string,
String separator,
Procedure<String> procedure)
|
static String |
getFirstToken(String value,
String separator) |
static String |
getLastToken(String value,
String separator) |
static <T,R> R |
injectIntoTokens(String string,
String separator,
R injectedValue,
Function2<R,String,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(String string) |
static boolean |
isEmpty(String string) |
static boolean |
isEmptyOrWhitespace(String string) |
static boolean |
isNumber(String string) |
static boolean |
noneSatisfy(String string,
CharPredicate predicate) |
static boolean |
noneSatisfy(String string,
CodePointPredicate predicate) |
static boolean |
notEmpty(String string) |
static boolean |
notEmptyOrWhitespace(String string) |
static int |
occurrencesOf(String string,
char value)
Count the number of occurrences of the specified char.
|
static int |
occurrencesOf(String string,
int value)
Count the number of occurrences of the specified code point.
|
static int |
occurrencesOf(String string,
String singleCharacter)
Count the number of occurrences of the specified
string . |
static String |
padOrTrim(String message,
int targetLength) |
static String |
reject(String string,
CharPredicate predicate) |
static String |
reject(String string,
CodePointPredicate predicate) |
static String |
repeat(char c,
int repeatTimes) |
static String |
repeat(String template,
int repeatTimes) |
static void |
reverseForEach(String string,
CharProcedure procedure)
For each character in the
string in reverse order, execute the CharProcedure . |
static void |
reverseForEach(String string,
CodePointProcedure procedure)
For each character in the
string in reverse order, execute the CodePointProcedure . |
static String |
select(String string,
CharPredicate predicate) |
static String |
select(String string,
CodePointPredicate predicate) |
static Twin<String> |
splitAtIndex(String aString,
int index) |
static MutableBag<Character> |
toBag(String string) |
static MutableList<String> |
tokensToList(String string,
String separator)
Converts a string of tokens separated by the specified separator to a
MutableList . |
static MutableMap<String,String> |
tokensToMap(String string)
Converts a string of tokens to a
MutableMap using a | to separate pairs, and a : to separate key and
value. |
static MutableMap<String,String> |
tokensToMap(String string,
String pairSeparator,
String keyValueSeparator)
Converts a string of tokens to a
MutableMap using the specified separators. |
static <K,V> MutableMap<K,V> |
tokensToMap(String string,
String separator,
String keyValueSeparator,
Function<String,K> keyFunction,
Function<String,V> valueFunction)
Converts a string of tokens to a
MutableMap using the specified 'key' and 'value'
Functions. |
static MutableList<String> |
tokensToReverseSortedList(String string,
String separator)
Converts a string of tokens separated by the specified separator to a reverse sorted
MutableList . |
static MutableSet<String> |
tokensToSet(String string,
String separator)
Converts a string of tokens to a
MutableSet . |
static MutableList<String> |
tokensToSortedList(String string,
String separator)
Converts a string of tokens separated by the specified separator to a sorted
MutableList . |
static MutableList<Character> |
toList(String string) |
static MutableBag<Character> |
toLowercaseBag(String string) |
static MutableList<Character> |
toLowercaseList(String string) |
static MutableSet<Character> |
toLowercaseSet(String string) |
static MutableSet<Character> |
toSet(String string) |
static MutableBag<Character> |
toUppercaseBag(String string) |
static MutableList<Character> |
toUppercaseList(String string) |
static MutableSet<Character> |
toUppercaseSet(String string) |
static MutableList<String> |
trimmedTokensToList(String string,
String separator)
Converts a string of tokens separated by the specified separator to a
MutableList . |
static MutableList<String> |
trimmedTokensToSortedList(String string,
String separator)
Converts a string of tokens separated by the specified separator to a sorted
MutableList . |
@Deprecated public static MutableList<String> csvTokensToSortedList(String string)
MutableList
.@Deprecated public static MutableList<String> csvTrimmedTokensToSortedList(String string)
MutableList
.public static MutableList<String> tokensToSortedList(String string, String separator)
MutableList
.public static MutableList<String> trimmedTokensToSortedList(String string, String separator)
MutableList
.@Deprecated public static MutableList<String> csvTokensToList(String string)
MutableList
.@Deprecated public static MutableList<String> csvTrimmedTokensToList(String string)
MutableList
.public static MutableList<String> tokensToList(String string, String separator)
MutableList
.public static MutableList<String> trimmedTokensToList(String string, String separator)
MutableList
.@Deprecated public static MutableSet<String> csvTokensToSet(String string)
MutableSet
.public static MutableSet<String> tokensToSet(String string, String separator)
MutableSet
.public static MutableMap<String,String> tokensToMap(String string)
MutableMap
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"public static MutableMap<String,String> tokensToMap(String string, String pairSeparator, String keyValueSeparator)
MutableMap
using the specified separators.public static <K,V> MutableMap<K,V> tokensToMap(String string, String separator, String keyValueSeparator, Function<String,K> keyFunction, Function<String,V> valueFunction)
MutableMap
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]}@Deprecated public static MutableList<String> csvTokensToReverseSortedList(String string)
MutableList
.public static MutableList<String> tokensToReverseSortedList(String string, String separator)
MutableList
.public static void forEachToken(String string, String separator, Procedure<String> procedure)
public static <T,R> R injectIntoTokens(String string, String separator, R injectedValue, Function2<R,String,R> function)
Iterate.injectInto(Object, Iterable, Function2)
public static void forEachTrimmedToken(String string, String separator, Procedure<String> procedure)
@Deprecated public static void forEach(String string, CharProcedure procedure)
forEach(String, CharProcedure)
instead.string
, execute the CharProcedure
.public static void forEach(String string, CharProcedure procedure)
string
, execute the CharProcedure
.public static void forEach(String string, CodePointProcedure procedure)
string
, execute the CodePointProcedure
.public static void reverseForEach(String string, CharProcedure procedure)
string
in reverse order, execute the CharProcedure
.public static void reverseForEach(String string, CodePointProcedure procedure)
string
in reverse order, execute the CodePointProcedure
.@Deprecated public static int count(String string, CharPredicate predicate)
predicate
.public static int count(String string, CharPredicate predicate)
predicate
.public static int count(String string, CodePointPredicate predicate)
predicate
.@Deprecated public static String collect(String string, CharFunction function)
collect(String, CharToCharFunction)
instead.public static String collect(String string, CharToCharFunction function)
public static String collect(String string, CodePointFunction function)
public static Character detect(String string, CharPredicate predicate)
predicate
.public static Character detectIfNone(String string, CharPredicate predicate, char resultIfNone)
predicate
. Return the default char if
no value is found.public static Character detectIfNone(String string, CharPredicate predicate, String resultIfNone)
predicate
. Return the first char of the
default string if no value is found.public static int occurrencesOf(String string, char value)
public static int occurrencesOf(String string, int value)
public static int occurrencesOf(String string, String singleCharacter)
string
.public static boolean anySatisfy(String string, CharPredicate predicate)
string
answer true for the specified predicate
.public static boolean anySatisfy(String string, CodePointPredicate predicate)
string
answer true for the specified predicate
.public static boolean allSatisfy(String string, CharPredicate predicate)
string
answer true for the specified predicate
.public static boolean allSatisfy(String string, CodePointPredicate predicate)
string
answer true for the specified predicate
.public static boolean noneSatisfy(String string, CharPredicate predicate)
string
answer true for the specified predicate
.public static boolean noneSatisfy(String string, CodePointPredicate predicate)
string
answer true for the specified predicate
.public static String select(String string, CharPredicate predicate)
predicate
.public static String select(String string, CodePointPredicate predicate)
predicate
.public static String reject(String string, CharPredicate predicate)
predicate
.public static String reject(String string, CodePointPredicate predicate)
predicate
.public static boolean isEmpty(String string)
public static boolean isEmptyOrWhitespace(String string)
public static boolean isNumber(String string)
public static boolean isAlphaNumeric(String string)
public static boolean notEmpty(String string)
public static boolean notEmptyOrWhitespace(String string)
public static String repeat(char c, int repeatTimes)
public static MutableList<Character> toList(String string)
public static MutableList<Character> toLowercaseList(String string)
public static MutableList<Character> toUppercaseList(String string)
public static MutableBag<Character> toBag(String string)
public static MutableBag<Character> toLowercaseBag(String string)
public static MutableBag<Character> toUppercaseBag(String string)
public static MutableSet<Character> toSet(String string)
@Deprecated public static MutableSet<Character> asUppercaseSet(String string)
public static MutableSet<Character> toUppercaseSet(String string)
@Deprecated public static MutableSet<Character> asLowercaseSet(String string)
public static MutableSet<Character> toLowercaseSet(String string)
Copyright © 2004–2018. All rights reserved.