Modifier and Type | Field and Description |
---|---|
static Predicate<String> |
alphabetic
Alphabetic strings are at least one character, and all
letters . |
static Predicate<String> |
alphanumeric
|
static Predicate<String> |
blank
A blank string is either
null , empty, or
all characters are whitespace . |
static Fn<String,Iterable<Byte>> |
bytes
Yields the bytes of a String.
|
static Fn2<Object,Object,String> |
concat
Concatenate a string with the
string representation
of an arbitrary object, i.e. |
static Fn<String,Integer> |
length
Gives the length of a string, i.e. the amount of characters.
|
static Fn<String,String> |
lowerCased
Convert a string to
lower case . |
static Predicate<String> |
nonblank
A nonblank string has at least one character, and must contain at least
one character which is
not whitespace . |
static Predicate<String> |
numeric
A numeric string must have at least one character, and all of them
must be
digits . |
static Fn<String,String> |
reversed
Yields the given string with its characters in reversed order.
|
static Fn<String,Iterable<Character>> |
toChars
Splits a string into characters.
|
static Fn<String,Double> |
toDouble
Converts a string to a
double value using Double.valueOf(String) . |
static Fn<String,Integer> |
toInt
Converts a string to a
int value using Integer.valueOf(String) . |
static Fn<String,Long> |
toLong
Converts a string to a
long value using Long.valueOf(String) . |
static Fn<String,String> |
trimmed
Trims a string, removing all leading and trailing whitespace.
|
static Fn<String,String> |
upperCased
Convert a string to
upper case |
Modifier and Type | Method and Description |
---|---|
static Fn<String,String> |
after(String substring)
Inside strings, searches for the first occurence of a substring, and yields the
rest of the string after the substring occurence, not including the
substring itself.
|
static Fn<String,String> |
afterLast(String substring)
Inside strings, searches for the last occurence of a substring, and yields the
rest of the string after the substring occurence, not including the
substring itself.
|
static Fn<String,Iterable<String>> |
allBetween(String openSubstring,
String closeSubstring)
Yield all strings occurring _between_ two substrings.
|
static Predicate<String> |
allChars(Predicate<Character> valid)
Predicate verifying that all characters in a string satifies a given predicate.
|
static Fn<Object,String> |
append(String suffix)
Create a new strings by appending a suffix.
|
static Fn<String,String> |
before(Fn<? super String,Integer> index)
Yields substrings before a position index.
|
static Fn<String,String> |
before(int index)
Yields substrings before a position index.
|
static Fn<String,String> |
before(String substring)
Inside strings, searches for the first occurence of a substring, and yields the
the string before the substring occurence, not including the
substring itself.
|
static Fn<String,String> |
beforeLast(String substring)
Inside strings, searches for the last occurence of a substring, and yields the
the string before the substring occurence, not including the
substring itself.
|
static Fn<String,String> |
between(String openSubstring,
String closeSubstring)
Yield the string _between_ two substrings.
|
static Fn<String,String> |
betweenOuter(String openSubstring,
String closeSubstring)
Yield the string _between_ two outermost substrings.
|
static Predicate<String> |
contains(CharSequence charSequence)
Determines if a substring is present in a string.
|
static Predicate<String> |
endsWith(String suffix)
Determines if a string ends with a given suffix string.
|
static Fn<String,String> |
first(int charAmount)
Get at most a given amount of the first characters of strings.
|
static Fn<String,String> |
from(Fn<? super String,Integer> index)
Yields substrings from a position index.
|
static Fn<String,String> |
from(int index)
Yields substrings from a position index.
|
static Predicate<String> |
hasLength(int exactLength)
Evaluate if strings are of a exact length.
|
static Predicate<String> |
hasLength(Predicate<? super Integer> accepted)
Evaluate if strings have accepted lengths.
|
static Fn<Object,String> |
inBetween(String prefix,
String suffix)
Insert strings in between a prefix and a suffix.
|
static Fn<String,Integer> |
indexOf(char c)
Yields index position of first occurence of a
char , or null
if the char cannot be found. |
static Fn<String,Integer> |
indexOf(String substring)
Yields index position of first occurence of a substring, or
null
if the substring cannot be found. |
static Fn<String,String> |
last(int charAmount)
Get at most a given amount of the last characters of strings.
|
static Fn<String,Integer> |
lastIndexOf(char c)
Yields index position of last occurence of a
char , or null
if the char cannot be found. |
static Fn<String,Integer> |
lastIndexOf(String substring)
Yields index position of last occurence of a substring, or
null
if the substring cannot be found. |
static Predicate<String> |
matches(String regex)
Does a
regular expression match on strings. |
static Predicate<String> |
nonblankAllChars(Predicate<Character> valid)
Predicate verifying that strings are
not blank and
each char satisfies a given predicate. |
static Fn<Object,String> |
prepend(String prefix)
Create a new strings by prepending a prefix.
|
static Fn<String,String> |
repeat(int times)
Repeats a string a given amount of times.
|
static Fn<String,String> |
repeat(int times,
String separator)
Repeats a string, insterting given separator, a given amount of times.
|
static Fn<String,Iterable<String>> |
splittingOn(char character)
Split a string on each occurence of a
char delimiter. |
static Fn<String,Iterable<String>> |
splittingOn(Predicate<? super Character> character)
Split a string into several on any character passing the given
Character predicate. |
static Fn<String,Iterable<String>> |
splittingOn(String substring)
Split a string on each occurence of a substring.
|
static Predicate<String> |
startsWith(String prefix)
Determines if a string starts with a given prefix string.
|
static Fn<String,String> |
substring(Fn<? super String,Integer> beginIndex,
Fn<? super String,Integer> endIndex) |
static Fn<String,String> |
substring(int beginIndex,
int endIndex)
Extract substring from strings.
|
public static final Fn<String,Integer> toInt
int
value using Integer.valueOf(String)
.
If the string is null
, 0 is yielded.public static final Fn<String,Double> toDouble
double
value using Double.valueOf(String)
.
If the string is null
, 0 is yielded.public static final Fn<String,Iterable<Byte>> bytes
String.getBytes()
public static final Predicate<String> blank
null
, empty, or
all characters are whitespace
.public static final Predicate<String> nonblank
not whitespace
.public static final Predicate<String> numeric
digits
.public static final Predicate<String> alphabetic
letters
.public static final Fn<String,String> trimmed
public static final Fn<String,String> lowerCased
lower case
.public static final Fn<String,String> upperCased
upper case
public static final Fn<String,Integer> length
null
yields length 0.public static final Fn2<Object,Object,String> concat
string representation
of an arbitrary object, i.e. reduces two strings to one.public static final Predicate<String> allChars(Predicate<Character> valid)
valid
- The predicate evaluating all characters in a string.public static final Predicate<String> nonblankAllChars(Predicate<Character> valid)
not blank
and
each char satisfies a given predicate.valid
- public static final Predicate<String> hasLength(int exactLength)
nulls are considered to have length zero.
public static final Predicate<String> hasLength(Predicate<? super Integer> accepted)
nulls are considered to have length zero.
accepted
- The predicate evaluating accepted length.public static Predicate<String> contains(CharSequence charSequence)
null
,
nor does null
contain any substring.charSequence
- The substring to find.public static Predicate<String> startsWith(String prefix)
prefix
- The prefix.public static Predicate<String> endsWith(String suffix)
suffix
- The suffix.public static Predicate<String> matches(String regex)
regular expression match
on strings.regex
- The regular expression to use for matching.public static Fn<Object,String> prepend(String prefix)
prefix
- the prefix to prependpublic static Fn<Object,String> append(String suffix)
suffix
- the suffix to appendpublic static Fn<String,String> substring(int beginIndex, int endIndex)
String.substring(int, int)
, it
may throw an IndexOutOfBoundsException
if the given indexes
are invalid.beginIndex
- The index of the first character to include.endIndex
- The index to end the extraction.public static Fn<String,String> substring(Fn<? super String,Integer> beginIndex, Fn<? super String,Integer> endIndex)
public static Fn<String,String> first(int charAmount)
public static Fn<String,String> last(int charAmount)
public static Fn<Object,String> inBetween(String prefix, String suffix)
prefix
- The prefix to appear before the string.suffix
- The suffix to appear after the stringpublic static Fn<String,String> repeat(int times)
times
- The amount of times to repeat the string.public static Fn<String,String> repeat(int times, String separator)
times
- The amount of times to repeat the string.separator
- The separator string to insert between the repeating strings.public static Fn<String,String> after(String substring)
Passing null
to the Fn
always yields null
If the substring is not found (or it is null
), then null
is returned.
If the substring is the empty string, the original string is returned.
substring
- the substring to search for.public static Fn<String,String> afterLast(String substring)
Passing null
to the Fn
always yields null
If the substring is not found, or if it is null
, then null
is returned.
If the substring is empty, the empty string is returned.
substring
- the substring to search for.public static Fn<String,String> from(int index)
from(Fn)
public static Fn<String,String> from(Fn<? super String,Integer> index)
Fn
yields null
, then null
is returned.
If a positive index out of bounds with the length of the string
is yielded, the empty string is returned.
A negative index value is invalid and will throw an StringIndexOutOfBoundsException
.
Passing the null
-String always yields null
.
index
- The Fn
to resolve the index.public static Fn<String,String> before(String substring)
Passing null
to the Fn
always yields null
If the substring is null
, the original string is returned.
If the substring is not found, null
is returned.
If the substring is the empty string, or found from the beginning of the string, the empty string is returned.
substring
- the substring to search for.public static Fn<String,String> beforeLast(String substring)
Passing null
to the Fn
always yields null
If the substring is null
or empty, the original string is returned.
If the substring is not found, null
is returned.
substring
- the substring to search for.public static Fn<String,String> before(int index)
before(Fn)
public static Fn<String,String> before(Fn<? super String,Integer> index)
Fn
yields null
, or a positive index out of bounds
with the length of the string, the original string is returned.
A negative index is invalid and will throw an StringIndexOutOfBoundsException
.
Passing the null
-String always yields null
.
index
- The Fn
to resolve the index.public static Fn<String,String> between(String openSubstring, String closeSubstring)
between("x", "y")
applied to the string
"xxyy"
will yield "x"
.openSubstring
- closeSubstring
- public static Fn<String,String> betweenOuter(String openSubstring, String closeSubstring)
betweenOuter("x", "y")
applied to the string
"xxyy"
will yield "xy"
.openSubstring
- closeSubstring
- public static Fn<String,Iterable<String>> allBetween(String openSubstring, String closeSubstring)
openSubstring
- closeSubstring
- public static Fn<String,Integer> indexOf(char c)
char
, or null
if the char
cannot be found.String.indexOf(int)
public static Fn<String,Integer> lastIndexOf(char c)
char
, or null
if the char
cannot be found.String.indexOf(int)
public static Fn<String,Integer> indexOf(String substring)
null
if the substring cannot be found.String.indexOf(String)
public static Fn<String,Integer> lastIndexOf(String substring)
null
if the substring cannot be found.String.indexOf(String)
public static Fn<String,Iterable<String>> splittingOn(String substring)
substring
- public static Fn<String,Iterable<String>> splittingOn(char character)
char
delimiter.
The splitting character is not included in the resulting strings, and any
consecutive occurrences of the character are treated as one delimiter instance.character
- the delimiter characterpublic static Fn<String,Iterable<String>> splittingOn(Predicate<? super Character> character)
Character
predicate.
The characters accepted by the predicate is not included in the
resulting strings, and any consecutive accepted characters are
treated as one delimiter instance.character
- the predicate which decides if a character is
a delimiter.Copyright © 2016. All rights reserved.