public class Str extends StrBase<Str>
C.List.Cursor<T>C.Featured.Factory| Modifier and Type | Field and Description |
|---|---|
static Str |
EMPTY_STR |
modCount| Modifier | Constructor and Description |
|---|---|
protected |
Str() |
| Modifier and Type | Method and Description |
|---|---|
protected Str |
_empty()
Check if the str is empty
|
protected Class<Str> |
_impl()
Return the class of the implementation
|
Str |
afterFirst(char c) |
Str |
afterFirst(Str s) |
Str |
afterFirst(String s) |
Str |
afterLast(char c) |
Str |
afterLast(Str s) |
Str |
afterLast(String s) |
Str |
append(C.List<Character> list)
Return a str instance contains all characters of this str instance append with
all characters in the list specified
|
Str |
append(char... array)
Return a str instance contains all characters of this str instance append with
all characters in the array specified
|
Str |
append(Character character)
Returns a str instance contains all characters of this str instance appended with
the character specified
|
Str |
append(Collection<? extends Character> collection)
Return a str instance contains all characters of this str append with all
characters in the collection specified
|
Str |
append(Str s)
Returns a str instance contains all characters of this str instance appended with
all characters in teh str specified
|
Str |
append(String s)
Returns a str instance contains all characters of this str instance appended
with all characters in the
String specified |
Str |
beforeFirst(char c) |
Str |
beforeFirst(Str s) |
Str |
beforeFirst(String s) |
Str |
beforeLast(char c) |
Str |
beforeLast(Str s) |
Str |
beforeLast(String s) |
Str |
capFirst() |
char[] |
charArray() |
char |
charAt(int index) |
int |
compareTo(CharSequence x)
Compare the char sequence specified against this str
|
int |
compareTo(Str o) |
int |
compareToIgnoreCase(CharSequence x)
Compare the char sequence specified against this str in a case insensitive
manner
|
int |
compareToIgnoreCase(Str x)
Compare the str specified against this str in a case insensitive
manner
|
boolean |
contains(CharSequence s) |
boolean |
contentEquals(CharSequence x)
Check if this str content is equals to the char sequence specified
|
boolean |
contentEquals(Str x)
Check if this str content iks equals to the str specified
|
int |
count(Str search,
boolean overlap) |
int |
count(String search,
boolean overlap) |
Str |
decodeBASE64() |
Str |
dropWhile(Osgl.Function<? super Character,Boolean> predicate)
Return a str that without the first N characters in the string.
|
Str |
encodeBASE64() |
boolean |
endsWith(CharSequence suffix,
int offset)
Check if this str ends with a char sequence, with the search starts at
the specified offset
|
boolean |
endsWith(Str suffix,
int toffset)
Check this str instance ends with str, with the search starts at
specified offset
|
boolean |
equalsIgnoreCase(CharSequence x)
Compare content of the str and the specified char sequence, case insensitive
|
byte[] |
getBytes()
Encodes this str into a sequence of bytes using the
platform's default charset, storing the result into a new byte array.
|
byte[] |
getBytes(Charset charset)
Encodes this str into a sequence of bytes using the given
charset, storing the result into a
new byte array.
|
byte[] |
getBytes(String charsetName)
Encodes this str into a sequence of bytes using the named
charset, storing the result into a new byte array.
|
byte[] |
getBytesAscII()
Returns byte array of string composed of only ascii chars
|
byte[] |
getBytesUTF8()
Returns byte array of string composed of UTF-8 chars
|
void |
getChars(int srcBegin,
int srcEnd,
char[] dst,
int dstBegin)
Copy part of the char sequence into another array
|
int |
hashCode() |
int |
indexOf(CharSequence str,
int fromIndex)
Returns the index within this str of the first occurrence of the
specified substring, starting at the specified index.
|
int |
indexOf(int ch,
int fromIndex)
Returns the index within this str of the first occurrence of
the specified character.
|
int |
indexOf(Str str,
int fromIndex)
Locate another str inside this str, start at the specified index
|
Str |
insert(int index,
char... ca)
Return a new str with character array inserted into the char sequence of this str
|
Str |
insert(int index,
char character)
Return a new str with character inserted into the char sequence of this str
|
Str |
insert(int index,
Character... ca)
Return a new str with character array inserted into the char sequence of this str
|
Str |
insert(int index,
Character character)
Return a new str with character inserted into the char sequence of this str
|
Str |
insert(int index,
StrBase<?> str)
Returns a new str with a string specified inserted into the char sequence of this str
|
Str |
insert(int index,
String s)
Returns a new str with a string specified inserted into the char sequence of this str
|
String |
intern() |
boolean |
isBlank()
Check if this str is blank (empty or all space characters)
|
boolean |
isEmpty()
Is this traversal empty?
|
int |
lastIndexOf(CharSequence str,
int fromIndex)
Returns the index within this str of the last occurrence of the
specified substring, searching backward starting at the specified index.
|
int |
lastIndexOf(int ch,
int fromIndex)
Returns the index within this str of the last occurrence of
the specified character, searching backward starting at the
specified index.
|
int |
lastIndexOf(Str str,
int fromIndex)
Returns the index within this str of the last occurrence of the
specified str, searching backward starting at the specified index.
|
int |
length() |
Str |
lpad(char c,
int times)
Alias of
StrBase.padLeft(char, int) |
Str |
lpad(int times)
Alias of
StrBase.padLeft(int) |
boolean |
matches(String regex)
Tells whether or not this str matches the given regular expression.
|
static Str |
of(char... ca) |
static Str |
of(Character... chars) |
static Str |
of(Collection<Character> col) |
static Str |
of(Iterable<Character> itr) |
static Str |
of(Iterator<Character> itr) |
static Str |
of(String s) |
static Str |
of(StringBuilder sb) |
Str |
padLeft(char c,
int times)
Returns a str instance with `times` of char `c` left pad to the current str
|
Str |
padLeft(int times)
Returns a str instance with `times` of char `' '` (space) left pad to the current str
|
Str |
padRight(char c,
int times)
Returns a str instance with `times` of char `c` right pad to the current str
|
Str |
padRight(int times)
Returns a str instance with `times` of char `' '` (space) right pad to the current str
|
Str |
prepend(C.List<Character> list)
Return a str instance contains all characters of this str instance prepended with
all characters in the list specified
|
Str |
prepend(char... chars)
Return a str instance contains all characters of this str instance prepended with
all characters in the array specified
|
Str |
prepend(Character character)
Returns a str instance contains all characters of this str instance prepended with
the character specified
|
Str |
prepend(Collection<? extends Character> collection)
Returns a str instance contains all characters of this str instance prepended
with all characters in teh collection
|
Str |
prepend(Str s)
Returns a str instance contains all characters of this str instance prepended with
all characters in the str specified
|
Str |
prepend(String s)
Returns a str instance contains all characters of this str instance prepended
with all characters in the
String specified |
boolean |
regionMatches(boolean ignoreCase,
int toffset,
CharSequence other,
int ooffset,
int len)
Tests if two string regions are equal.
|
boolean |
regionMatches(boolean ignoreCase,
int toffset,
Str other,
int ooffset,
int len)
Tests if two string regions are equal.
|
Str |
remove(Osgl.Function<? super Character,Boolean> predicate)
Returns a str that with all characters in this str instance except those matches the
test of predicate function specified
|
Str |
replace(char oldChar,
char newChar)
Returns a new str resulting from replacing all occurrences of
oldChar in this string with newChar. |
Str |
replace(CharSequence target,
CharSequence replacement)
Replaces each substring of this str that matches the literal target
sequence with the specified literal replacement sequence.
|
Str |
replaceAll(String regex,
String replacement)
Replaces each substr of this str that matches the given regular expression with the
given replacement.
|
Str |
replaceFirst(String regex,
String replacement)
Replaces the first substring of this str that matches the given regular expression with the
given replacement.
|
Str |
reverse()
Returns a str that contains all characters in this str instance but in a
reversed order.
|
Str |
rpad(char c,
int times)
Alias of
StrBase.padRight(char, int) |
Str |
rpad(int times)
Alias of
StrBase.padRight(int) |
C.List<Str> |
split(String regex,
int limit) |
boolean |
startsWith(CharSequence prefix,
int toffset)
Check if this str starts with a char sequence, with the search starts at
the specified offset
|
boolean |
startsWith(Str prefix,
int toffset)
Check this str instance starts with str, with the search starts at
specified offset
|
Str |
strip(String prefix,
String suffix) |
Str |
subList(int fromIndex,
int toIndex)
Returns a sub str that is a part of this str
|
Str |
subSequence(int start,
int end)
Return a part of this str specified by start inclusive and end exclusive position.
|
String |
substring(int beginIndex)
Return a sub string of type
String of this
str starts from beginIndex specified till the end
of the char array of this str |
String |
substring(int beginIndex,
int endIndex)
Returns a new string that is a substring of this str.
|
Str |
takeWhile(Osgl.Function<? super Character,Boolean> predicate)
Return a str that contains the first N characters in this string, the characters
in the new str must matches the test specified by the predicate function.
|
Str |
times(int n)
Returns a str instance that repeat this str's char sequence for
n
times |
FastStr |
toFastStr()
Return a
FastStr that contains all the char sequence
in this str instance |
Str |
toLowerCase(Locale locale) |
String |
toString() |
Str |
toUpperCase(Locale locale) |
Str |
trim() |
Str |
urlEncode() |
accept, acceptLeft, acceptRight, add, after, after, before, before, concat, concat, contains, contentEquals, copy, copy, count, count, countWithOverlap, countWithOverlap, cutOff, drop, eager, empty, endsWith, endsWith, eq, eq, eq, equals, filter, flatMap, get, head, indexOf, indexOf, indexOf, indexOf, indexOf, indexOf, initFeatures, lastIndexOf, lastIndexOf, lastIndexOf, lastIndexOf, lastIndexOf, lastIndexOf, lazy, listIterator, lower, lower, map, maxLength, notEmpty, parallel, pos, pos, pos, pos, pos, pos, readOnly, regionMatches, regionMatches, remove, rpos, rpos, rpos, rpos, rpos, rpos, set, setFeature, size, snapshot, split, startsWith, startsWith, substr, substr, tail, tail, take, toCharArray, toLowerCase, toUpperCase, unsetFeature, upper, upper, val, valueaccept, acceptLeft, acceptRight, add, addAll, allMatch, anyMatch, append, append, append, append, append, appendList, appendReversibleSeq, count, each, each, features_, features, findFirst, findLast, findOne, first, forEach, forEach, forEachLeft, forEachLeft, forEachRight, forEachRight, head, insert, is, isImmutable, isLazy, isMutable, isReadOnly, iterator, last, locate, locateFirst, locateLast, noneMatch, prepend, prepend, prepend, prepend, prepend, prependList, prependReversibleSeq, reduce, reduce, reduceLeft, reduceLeft, reduceRight, reduceRight, reverseIterator, sequential, sorted, sorted, split, unique, unique, without, without, without, zip, zip, zip, zipAll, zipAll, zipAll, zipWithIndexaddAll, clear, listIterator, removeRangeaddAll, contains, containsAll, remove, removeAll, retainAll, toArray, toArrayclone, finalize, getClass, notify, notifyAll, wait, wait, waitchars, codePointsaddAll, addAll, clear, contains, containsAll, listIterator, remove, removeAll, replaceAll, retainAll, sort, spliterator, toArray, toArrayparallelStream, removeIf, streampublic static final Str EMPTY_STR
protected Class<Str> _impl()
StrBasepublic int length()
public boolean isEmpty()
C.TraversableisEmpty in interface Collection<Character>isEmpty in interface List<Character>isEmpty in interface C.Traversable<Character>isEmpty in class AbstractCollection<Character>true if the traversal is empty or false otherwisepublic boolean isBlank()
StrBasepublic Str subList(int fromIndex, int toIndex)
StrBasesubList in interface List<Character>subList in interface C.List<Character>subList in class StrBase<Str>fromIndex - the from (inclusive)toIndex - the to (exclusive)fromIndex and end at (@code toIndex)StrBase.subSequence(int, int),
StrBase.substr(int, int)public Str takeWhile(Osgl.Function<? super Character,Boolean> predicate)
StrBasetakeWhile in interface C.List<Character>takeWhile in interface C.ReversibleSequence<Character>takeWhile in interface C.Sequence<Character>takeWhile in class StrBase<Str>predicate - test if the character should be put into the new str or should stop matchingpublic Str dropWhile(Osgl.Function<? super Character,Boolean> predicate)
StrBasedropWhile in interface C.List<Character>dropWhile in interface C.ReversibleSequence<Character>dropWhile in interface C.Sequence<Character>dropWhile in class StrBase<Str>predicate - the function test if character should be dropped in the new str
or stop match operationpublic Str remove(Osgl.Function<? super Character,Boolean> predicate)
StrBasepublic Str insert(int index, char character) throws StringIndexOutOfBoundsException
StrBaseinsert in class StrBase<Str>index - the position to insert the charactercharacter - the char to be insertedStringIndexOutOfBoundsException - if index is lesser than
0 or greater than or equals to StrBase.size() of the strpublic Str insert(int index, Character character) throws IndexOutOfBoundsException
StrBaseinsert in interface C.List<Character>insert in class StrBase<Str>index - the position to insert the charactercharacter - the char to be insertedIndexOutOfBoundsException - Math.abs(index) > size()public Str insert(int index, Character... ca) throws StringIndexOutOfBoundsException
StrBaseinsert in interface C.List<Character>insert in class StrBase<Str>index - the position to insert the characterca - the char array to be insertedStringIndexOutOfBoundsException - if index is lesser than
0 or greater than or equals to StrBase.size() of the strpublic Str insert(int index, char... ca) throws StringIndexOutOfBoundsException
StrBaseinsert in class StrBase<Str>index - the position to insert the characterca - the char array to be insertedStringIndexOutOfBoundsException - if index is lesser than
0 or greater than or equals to StrBase.size() of the strpublic Str insert(int index, StrBase<?> str) throws StringIndexOutOfBoundsException
StrBaseinsert in class StrBase<Str>index - the position to insert the stringstr - the str to be insertedStringIndexOutOfBoundsException - if index is lesser than
0 or greater than or equals to StrBase.size() of the strpublic Str insert(int index, String s) throws StringIndexOutOfBoundsException
StrBaseinsert in class StrBase<Str>index - the position to insert the strings - the string to be insertedStringIndexOutOfBoundsException - if index is lesser than
0 or greater than or equals to StrBase.size() of the strpublic Str reverse()
StrBasereverse in interface C.List<Character>reverse in interface C.ReversibleSequence<Character>reverse in class StrBase<Str>C.Feature.LIMITED,
C.Featured.is(org.osgl.util.C.Feature)public Str append(Collection<? extends Character> collection)
StrBasepublic Str append(C.List<Character> list)
StrBasepublic Str append(char... array)
StrBasepublic Str append(Character character)
StrBaseappend in interface C.List<Character>append in interface C.ReversibleSequence<Character>append in interface C.Sequence<Character>append in class StrBase<Str>character - the character to be appendedpublic Str append(Str s)
StrBasepublic Str append(String s)
StrBaseString specifiedpublic Str prepend(Collection<? extends Character> collection)
StrBasepublic Str prepend(C.List<Character> list)
StrBasepublic Str prepend(char... chars)
StrBasepublic Str prepend(Character character)
StrBaseprepend in interface C.List<Character>prepend in interface C.ReversibleSequence<Character>prepend in interface C.Sequence<Character>prepend in class StrBase<Str>character - the character to be preppendedpublic Str prepend(Str s)
StrBasepublic Str prepend(String s)
StrBaseString specifiedpublic char charAt(int index)
public Str subSequence(int start, int end)
StrBaseNote calling this method has the same effect with calling StrBase.subList(int, int)
and calling StrBase.substr(int, int)
subSequence in interface CharSequencesubSequence in class StrBase<Str>start - the start positionend - the end positionStrBase.subList(int, int),
StrBase.substr(int, int)public Str times(int n)
StrBasen
timespublic Str padLeft(char c, int times)
StrBasepublic Str lpad(char c, int times)
StrBaseStrBase.padLeft(char, int)public Str padLeft(int times)
StrBasepublic Str lpad(int times)
StrBaseStrBase.padLeft(int)public Str padRight(char c, int times)
StrBasepublic Str rpad(char c, int times)
StrBaseStrBase.padRight(char, int)public Str padRight(int times)
StrBasepublic Str rpad(int times)
StrBaseStrBase.padRight(int)public int compareTo(Str o)
public String toString()
toString in interface CharSequencetoString in class AbstractCollection<Character>public FastStr toFastStr()
StrBaseFastStr that contains all the char sequence
in this str instancepublic int hashCode()
public void getChars(int srcBegin,
int srcEnd,
char[] dst,
int dstBegin)
StrBasepublic byte[] getBytes()
StrBasegetBytes in class StrBase<Str>String.getBytes()public byte[] getBytes(String charsetName)
StrBasegetBytes in class StrBase<Str>charsetName - The name of a supported charset. If charsetName is null then this
function shall return the result of StrBase.getBytes()String.getBytes(String)public byte[] getBytes(Charset charset)
StrBasegetBytes in class StrBase<Str>charset - The Charset to be used to encode
the String. If charset is null then
this function shall return the result of StrBase.getBytes()String.getBytes(Charset)public byte[] getBytesAscII()
StrBasegetBytesAscII in class StrBase<Str>public byte[] getBytesUTF8()
StrBasegetBytesUTF8 in class StrBase<Str>public boolean contentEquals(CharSequence x)
StrBasecontentEquals in class StrBase<Str>x - the char sequence to be checked agains this strtrue if content of this str equals to that of the charspublic boolean contentEquals(Str x)
StrBasecontentEquals in class StrBase<Str>x - the str instancetrue if content of this str equals to that of the strpublic boolean equalsIgnoreCase(CharSequence x)
StrBaseequalsIgnoreCase in class StrBase<Str>x - the char sequence to be checkedtrue if the argument is not null and it
represents an equivalent String ignoring case; false otherwisepublic int compareTo(CharSequence x)
StrBasecompareTo in class StrBase<Str>x - the char sequence to be compared to this strString.compareTo(String)public int compareToIgnoreCase(Str x)
StrBasecompareToIgnoreCase in class StrBase<Str>x - the str to be compared to this strString.compareToIgnoreCase(String)public int compareToIgnoreCase(CharSequence x)
StrBasecompareToIgnoreCase in class StrBase<Str>x - the char sequence to be compared to this strString.compareToIgnoreCase(String)public boolean regionMatches(boolean ignoreCase,
int toffset,
Str other,
int ooffset,
int len)
StrBaseregionMatches in class StrBase<Str>ignoreCase - if true, ignore case when comparing
characters.toffset - the starting offset of the subregion in this
str.other - the str argument.ooffset - the starting offset of the subregion in the str
argument.len - the number of characters to compare.true if the specified subregion of this string
matches the specified subregion of the string argument;
false otherwise. Whether the matching is exact
or case insensitive depends on the ignoreCase
argument.String.regionMatches(boolean, int, String, int, int)public boolean regionMatches(boolean ignoreCase,
int toffset,
CharSequence other,
int ooffset,
int len)
StrBaseregionMatches in class StrBase<Str>ignoreCase - if true, ignore case when comparing
characters.toffset - the starting offset of the subregion in this
str.other - the char sequence argument.ooffset - the starting offset of the subregion in the str
argument.len - the number of characters to compare.true if the specified subregion of this string
matches the specified subregion of the string argument;
false otherwise. Whether the matching is exact
or case insensitive depends on the ignoreCase
argument.String.regionMatches(boolean, int, String, int, int)public boolean startsWith(Str prefix, int toffset)
StrBasestartsWith in class StrBase<Str>prefix - the str argumentstoffset - the offset where the search beginstrue if the search matches or false otherwisepublic boolean startsWith(CharSequence prefix, int toffset)
StrBasestartsWith in class StrBase<Str>prefix - the char sequence argumenttoffset - the start offset where search beginstrue if search matches or false otherwisepublic boolean endsWith(CharSequence suffix, int offset)
StrBasepublic boolean endsWith(Str suffix, int toffset)
StrBasepublic int indexOf(int ch,
int fromIndex)
StrBaseindexOf in class StrBase<Str>ch - a character (Unicode code point).fromIndex - the from index-1 if the character does not occur.String.indexOf(int, int)public int lastIndexOf(int ch,
int fromIndex)
StrBaselastIndexOf in class StrBase<Str>ch - a character (Unicode code point).fromIndex - the index to start the search from. There is no
restriction on the value of fromIndex. If it is
greater than or equal to the length of this str, it has
the same effect as if it were equal to one less than the
length of this str: this entire str may be searched.
If it is negative, it has the same effect as if it were -1:
-1 is returned.fromIndex, or -1
if the character does not occur before that point.String.lastIndexOf(int, int)public int indexOf(CharSequence str, int fromIndex)
StrBaseindexOf in class StrBase<Str>str - the substring to search for.fromIndex - the index from which to start the search.-1 if there is no such occurrence.String.indexOf(String, int)public int indexOf(Str str, int fromIndex)
StrBasepublic int lastIndexOf(CharSequence str, int fromIndex)
StrBaseThe returned index is the largest value k for which:
If no such value of k exists, thenk <= fromIndex && this.startsWith(str, k)
-1 is returned.lastIndexOf in class StrBase<Str>str - the string to search for.fromIndex - the index to start the search from.-1 if there is no such occurrence.String.lastIndexOf(String)public int lastIndexOf(Str str, int fromIndex)
StrBaseThe returned index is the largest value k for which:
If no such value of k exists, thenk <= fromIndex && this.startsWith(str, k)
-1 is returned.lastIndexOf in class StrBase<Str>str - the str to search for.fromIndex - the index to start the search from.-1 if there is no such occurrence.String.lastIndexOf(String),
StrBase.lastIndexOf(CharSequence, int)public String substring(int beginIndex)
StrBaseString of this
str starts from beginIndex specified till the end
of the char array of this strpublic String substring(int beginIndex, int endIndex)
StrBasebeginIndex and
extends to the character at index endIndex - 1.
Thus the length of the substring is endIndex-beginIndex.
substring in class StrBase<Str>beginIndex - the beginning index, inclusive.endIndex - the ending index, exclusive.String.substring(int, int)public Str replace(char oldChar, char newChar)
StrBaseoldChar in this string with newChar.
If the character oldChar does not occur in the
character sequence represented by this str object,
then a reference to this str object is returned.
Otherwise, a new str object is created that
represents a character sequence identical to the character sequence
represented by this str object, except that every
occurrence of oldChar is replaced by an occurrence
of newChar.
public boolean matches(String regex)
StrBasematches in class StrBase<Str>regex - the regular expression to which this string is to be matchedPattern,
String.matches(String)public boolean contains(CharSequence s)
public Str replaceFirst(String regex, String replacement)
StrBasereplaceFirst in class StrBase<Str>regex - the regular expression to which this str is to be matchedreplacement - the string to be substituted for the first matchPattern,
String.replaceFirst(String, String)public Str replaceAll(String regex, String replacement)
StrBasereplaceAll in class StrBase<Str>regex - the regular expression to which this string is to be matchedreplacement - the string to be substituted for each matchPattern,
String.replaceAll(String, String)public Str replace(CharSequence target, CharSequence replacement)
StrBasepublic Str toLowerCase(Locale locale)
toLowerCase in class StrBase<Str>public Str toUpperCase(Locale locale)
toUpperCase in class StrBase<Str>public Str afterFirst(Str s)
afterFirst in class StrBase<Str>public Str beforeLast(Str s)
beforeLast in class StrBase<Str>public Str afterFirst(String s)
afterFirst in class StrBase<Str>public Str afterFirst(char c)
afterFirst in class StrBase<Str>public Str beforeFirst(Str s)
beforeFirst in class StrBase<Str>public Str beforeFirst(String s)
beforeFirst in class StrBase<Str>public Str beforeLast(String s)
beforeLast in class StrBase<Str>public Str beforeFirst(char c)
beforeFirst in class StrBase<Str>public Str beforeLast(char c)
beforeLast in class StrBase<Str>public Str decodeBASE64()
decodeBASE64 in class StrBase<Str>public Str encodeBASE64()
encodeBASE64 in class StrBase<Str>public static Str of(char... ca)
public static Str of(StringBuilder sb)
public static Str of(Collection<Character> col)
Copyright © 2017. All Rights Reserved.