Top Description Inners Constructors Methods
org.eclipse.collections.impl.utility

public final Class StringIterate

extends Object
Class Inheritance
Imports
java.util.Collections, .List, .ListIterator, .StringTokenizer, org.eclipse.collections.api.bag.MutableBag, org.eclipse.collections.api.block.function.Function, .Function2, org.eclipse.collections.api.block.function.primitive.CharToCharFunction, org.eclipse.collections.api.block.predicate.primitive.CharPredicate, org.eclipse.collections.api.block.procedure.Procedure, org.eclipse.collections.api.block.procedure.primitive.CharProcedure, org.eclipse.collections.api.collection.MutableCollection, org.eclipse.collections.api.factory.Lists, .Maps, .Sets, org.eclipse.collections.api.list.MutableList, org.eclipse.collections.api.map.MutableMap, org.eclipse.collections.api.set.MutableSet, org.eclipse.collections.api.tuple.Twin, org.eclipse.collections.impl.bag.mutable.HashBag, org.eclipse.collections.impl.block.factory.primitive.CharToCharFunctions, org.eclipse.collections.impl.block.function.primitive.CharFunction, .CodePointFunction, org.eclipse.collections.impl.block.predicate.CodePointPredicate, org.eclipse.collections.impl.block.procedure.primitive.CodePointProcedure, org.eclipse.collections.impl.list.mutable.FastList, org.eclipse.collections.impl.string.immutable.CharAdapter, .CodePointAdapter, .CodePointList, org.eclipse.collections.impl.tuple.Tuples

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 and Inner Type Summary

Modifier and TypeClass and Description
private static class
private static class
private static class

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static boolean

Returns:

true if all the characters in the string answer true for the specified predicate.
allSatisfy
(String string, CharPredicate predicate)
Deprecated since 7.0.

public static boolean

Returns:

true if all the code points in the string answer true for the specified predicate.
allSatisfy
(String string, CodePointPredicate predicate)
Deprecated since 7.0.

public static boolean

Returns:

true if all the characters in the string answer true for the specified predicate.
allSatisfyChar
(String string, CharPredicate predicate)

public static boolean

Returns:

true if all the code points in the string answer true for the specified predicate.
allSatisfyCodePoint
(String string, CodePointPredicate predicate)

public static boolean

Returns:

true if any of the characters in the string answer true for the specified predicate.
anySatisfy
(String string, CharPredicate predicate)
Deprecated since 7.0.

public static boolean

Returns:

true if any of the code points in the string answer true for the specified predicate.
anySatisfy
(String string, CodePointPredicate predicate)
Deprecated since 7.0.

public static boolean

Returns:

true if any of the characters in the string answer true for the specified predicate.
anySatisfyChar
(String string, CharPredicate predicate)

public static boolean

Returns:

true if any of the code points in the string answer true for the specified predicate.
anySatisfyCodePoint
(String string, CodePointPredicate predicate)

public static CharAdapter
public static CodePointAdapter
public static MutableSet<Character>
asLowercaseSet(String string)
Deprecated in 3.0. Inlineable.

public static MutableSet<Character>
asUppercaseSet(String string)
Deprecated in 3.0. Inlineable.

private static boolean
public static MutableList<String>

Returns:

A MutableList containing Strings of size size, except the last will be truncated (i.e. shorter) if the characters don't divide evenly.
chunk
(String string, int
the number of characters per chunk
size
)

Partitions String in fixed size chunks.

public static String
collect(String string, CharFunction function)
Deprecated since 3.0.

public static String
collect(String string, CharToCharFunction function)
Deprecated since 7.0.

Transform the char elements to a new string using the specified function function.

public static String
collect(String string, CodePointFunction function)
Deprecated since 7.0.

Transform the int code point elements to a new string using the specified function function.

public static String
collectChar(String string, CharToCharFunction function)

Transform the char elements to a new string using the specified function function.

public static String
collectCodePoint(String string, CodePointFunction function)

Transform the int code point elements to a new string using the specified function function.

public static int
count(String string, CharPredicate predicate)
Deprecated since 3.0.

Count the number of elements that return true for the specified predicate.

public static int
count(String string, CharPredicate predicate)
Deprecated since 7.0.

Count the number of elements that return true for the specified predicate.

public static int
count(String string, CodePointPredicate predicate)
Deprecated since 7.0.

Count the number of elements that return true for the specified predicate.

public static int
countChar(String string, CharPredicate predicate)

Count the number of elements that return true for the specified predicate.

public static int
countCodePoint(String string, CodePointPredicate predicate)

Count the number of elements that return true for the specified predicate.

public 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.

Converts a string of tokens separated by commas to a MutableList.

public 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.

Converts a string of tokens separated by the specified separator to a reverse sorted MutableList.

public 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.

Converts a string of tokens separated by commas to a MutableSet.

public 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.

Converts a string of tokens separated by the specified separator to a sorted MutableList.

public 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.

Converts a string of tokens separated by commas to a MutableList.

public 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.

Converts a string of tokens separated by the specified separator to a sorted MutableList.

public static Character
detect(String string, CharPredicate predicate)
Deprecated since 7.0.

Find the first element that returns true for the specified predicate.

public static Character
detectChar(String string, CharPredicate predicate)

Find the first element that returns true for the specified predicate.

public static Character
detectCharIfNone(String string, CharPredicate predicate, char resultIfNone)

Find the first element that returns true for the specified predicate.

public static Character
detectCharIfNone(String string, CharPredicate predicate, String resultIfNone)

Find the first element that returns true for the specified predicate.

public static Character
detectIfNone(String string, CharPredicate predicate, char resultIfNone)
Deprecated since 7.0.

Find the first element that returns true for the specified predicate.

public static Character
detectIfNone(String string, CharPredicate predicate, String resultIfNone)
Deprecated since 7.0.

Find the first element that returns true for the specified predicate.

public static String
public static String
public static void
forEach(String string, CharProcedure procedure)
Deprecated since 3.0.

For each character in the string, execute the CharProcedure.

public static void
forEach(String string, CharProcedure procedure)
Deprecated since 7.0.

For each character in the string, execute the CharProcedure.

public static void
forEach(String string, CodePointProcedure procedure)
Deprecated since 7.0.

For each int code point in the string, execute the CodePointProcedure.

public static void
forEachChar(String string, CharProcedure procedure)

For each char in the string, execute the CharProcedure.

public static void
forEachCodePoint(String string, CodePointProcedure procedure)

For each int code point in the string, execute the CodePointProcedure.

public 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.

public static void
forEachTrimmedToken(String string, String separator, Procedure<String> procedure)

For each token in a string separated by the specified separator, execute the specified Procedure.

public static String
getFirstToken(String value, String separator)

public static String
getLastToken(String value, String separator)

public static <T, R> R
injectIntoTokens(String string, String separator, R injectedValue, Function2<? super R, 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.

public static boolean
public static boolean
isEmpty(String string)

public static boolean
public static boolean
isNumber(String string)

public static boolean
isSurrogate(String string, int i)

private static boolean
private static int
lastIndex(String string)

public static boolean

Returns:

true if none of the characters in the string answer true for the specified predicate.
noneSatisfy
(String string, CharPredicate predicate)
Deprecated since 7.0.

public static boolean

Returns:

true if none of the code points in the string answer true for the specified predicate.
noneSatisfy
(String string, CodePointPredicate predicate)
Deprecated since 7.0.

public static boolean

Returns:

true if none of the characters in the string answer true for the specified predicate.
noneSatisfyChar
(String string, CharPredicate predicate)

public static boolean

Returns:

true if none of the code points in the string answer true for the specified predicate.
noneSatisfyCodePoint
(String string, CodePointPredicate predicate)

public static boolean
notEmpty(String string)

public static boolean
public static int
numberOfChars(String string, int i)

public static int
occurrencesOf(String string, char value)
Deprecated since 7.0. Use occurrencesOfChar(String, char) instead.

Count the number of occurrences of the specified char.

public static int
occurrencesOf(String string, int value)
Deprecated since 7.0. Use occurrencesOfCodePoint(String, int) instead.

Count the number of occurrences of the specified int code point.

public static int
occurrencesOf(String string, String singleCharacter)

Count the number of occurrences of the specified string.

public static int
occurrencesOfChar(String string, char value)

Count the number of occurrences of the specified char.

public static int
occurrencesOfCodePoint(String string, int value)

Count the number of occurrences of the specified int code point.

public static String
padOrTrim(String message, int targetLength)

public static String

Returns:

a new string excluding all the characters that return true for the specified predicate.
reject
(String string, CharPredicate predicate)
Deprecated since 7.0.

public static String

Returns:

a new string excluding all the code points that return true for the specified predicate.
reject
(String string, CodePointPredicate predicate)
Deprecated since 7.0.

public static String

Returns:

a new string excluding all the characters that return true for the specified predicate.
rejectChar
(String string, CharPredicate predicate)

public static String

Returns:

a new string excluding all the code points that return true for the specified predicate.
rejectCodePoint
(String string, CodePointPredicate predicate)

public static String
repeat(String template, int repeatTimes)

public static String
repeat(char c, int repeatTimes)

public static void
reverseForEach(String string, CharProcedure procedure)
Deprecated since 7.0.

For each char in the string in reverse order, execute the CharProcedure.

public static void
reverseForEach(String string, CodePointProcedure procedure)
Deprecated since 7.0.

For each int code point in the string in reverse order, execute the CodePointProcedure.

public static void
reverseForEachChar(String string, CharProcedure procedure)

For each char in the string in reverse order, execute the CharProcedure.

public static void
reverseForEachCodePoint(String string, CodePointProcedure procedure)

For each int code point in the string in reverse order, execute the CodePointProcedure.

public static String

Returns:

a new string with all the characters that return true for the specified predicate.
select
(String string, CharPredicate predicate)
Deprecated since 7.0.

public static String

Returns:

a new string with all the code points that return true for the specified predicate.
select
(String string, CodePointPredicate predicate)
Deprecated since 7.0.

public static String

Returns:

a new string with all the characters that return true for the specified predicate.
selectChar
(String string, CharPredicate predicate)

public static String

Returns:

a new string with all the code points that return true for the specified predicate.
selectCodePoint
(String string, CodePointPredicate predicate)

public static Twin<String>
splitAtIndex(String aString, int index)

public static MutableBag<Character>
toBag(String string)

public static CodePointList
public static MutableList<String>
tokensToList(String string, String separator)

Converts a string of tokens separated by the specified separator to a MutableList.

public 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.

public static MutableMap<String, String>
tokensToMap(String string, String pairSeparator, String keyValueSeparator)

Converts a string of tokens to a 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)

Converts a string of tokens to a MutableMap using the specified 'key' and 'value' Functions.

public static MutableList<String>
tokensToReverseSortedList(String string, String separator)

Converts a string of tokens separated by the specified separator to a reverse sorted MutableList.

public static MutableSet<String>
tokensToSet(String string, String separator)

Converts a string of tokens to a MutableSet.

public static MutableList<String>
tokensToSortedList(String string, String separator)

Converts a string of tokens separated by the specified separator to a sorted MutableList.

public static MutableList<Character>
toList(String string)

public static MutableBag<Character>
public static MutableList<Character>
public static MutableSet<Character>
public static MutableSet<Character>
toSet(String string)

public static MutableBag<Character>
public static MutableList<Character>
public static MutableSet<Character>
public static MutableList<String>
trimmedTokensToList(String string, String separator)

Converts a string of tokens separated by the specified separator to a MutableList.

public static MutableList<String>
trimmedTokensToSortedList(String string, String separator)

Converts a string of tokens separated by the specified separator to a sorted MutableList.

private static <L extends List<String>> L

Returns:

the input list, mutated in place, containing trimmed strings.
trimStringList
(L strings)

Applies String#trim() to each String in the List

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait