public class FastStr extends StrBase<FastStr> implements RandomAccess, CharSequence, Serializable, Comparable<FastStr>
FastStr implements the same contract of Str with the a char array. This class is marked as Fast because of the following points: 1. When unsafeOf(String) is called, it share the internal value (the char array) of the String been passed in 2. when unsafeOf(char[]) is called, it use the char array passed in directly without copy operation 3. subList and substring works at O(1) because it will NOT copy the internal char array Note, this class shall be used with caution as it might prevent a very large char array from been garbage collected when the char array is passed to a FastStr or substr of the fast string
C.List.Cursor<T>C.Featured.Factory| Modifier and Type | Field and Description |
|---|---|
static FastStr |
EMPTY_STR |
modCount| Modifier and Type | Method and Description |
|---|---|
protected FastStr |
_empty()
Check if the str is empty
|
protected Class<FastStr> |
_impl()
Return the class of the implementation
|
FastStr |
afterFirst(char c) |
FastStr |
afterFirst(FastStr s) |
FastStr |
afterFirst(String s) |
FastStr |
afterLast(char c) |
FastStr |
afterLast(FastStr s) |
FastStr |
afterLast(String s) |
FastStr |
append(C.List<Character> list)
Return a str instance contains all characters of this str instance append with all characters in the list specified
|
FastStr |
append(char... array)
Return a str instance contains all characters of this str instance append with all characters in the array specified
|
FastStr |
append(Character character)
Returns a str instance contains all characters of this str instance appended with the character specified
|
FastStr |
append(Collection<? extends Character> collection)
Return a str instance contains all characters of this str append with all characters in the collection specified
|
FastStr |
append(FastStr s)
Returns a str instance contains all characters of this str instance appended with all characters in teh str specified
|
FastStr |
append(String s)
Returns a str instance contains all characters of this str instance appended with all characters in the
String specified |
FastStr |
beforeFirst(char c) |
FastStr |
beforeFirst(FastStr s) |
FastStr |
beforeFirst(String s) |
FastStr |
beforeLast(char c) |
FastStr |
beforeLast(FastStr s) |
FastStr |
beforeLast(String s) |
static char[] |
bufOf(CharSequence chars)
Return the char array that backed the char sequence specified
|
FastStr |
canonical() |
FastStr |
capFirst() |
char[] |
charArray()
Alias of
StrBase.toCharArray() |
char |
charAt(int index) |
int |
compareTo(CharSequence x)
Compare the char sequence specified against this str
|
int |
compareTo(FastStr o) |
int |
compareToIgnoreCase(CharSequence o)
Compare the char sequence specified against this str in a case insensitive manner
|
int |
compareToIgnoreCase(FastStr o)
Compare the str specified against this str in a case insensitive manner
|
boolean |
contains(CharSequence s)
Wrapper of
String.contains(CharSequence) |
boolean |
contentEquals(CharSequence x)
Wrapper of
String.contentEquals(CharSequence) |
boolean |
contentEquals(FastStr x)
Check if this str content iks equals to the str specified
|
FastStr |
copy()
Returns a copy of this str.
|
int |
count(FastStr search,
boolean overlap) |
int |
count(String search,
boolean overlap) |
FastStr |
decodeBASE64() |
FastStr |
dropWhile(Lang.Function<? super Character,Boolean> predicate)
Return a str that without the first N characters in the string.
|
FastStr |
encodeBASE64() |
boolean |
endsWith(CharSequence suffix,
int toffset)
Check if this str ends with a char sequence, with the search starts at the specified offset
|
boolean |
endsWith(FastStr prefix,
int toffset)
Check this str instance ends with str, with the search starts at specified offset
|
boolean |
equals(Object o) |
boolean |
equalsIgnoreCase(CharSequence x)
Wrapper of
String.equalsIgnoreCase(String) |
boolean |
equalsIgnoreCase(FastStr x) |
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(FastStr str,
int fromIndex)
Locate another str inside this str, start at the specified index
|
int |
indexOf(int ch,
int fromIndex)
Returns the index within this str of the first occurrence of the specified character.
|
FastStr |
insert(int index,
char... ca)
Return a new str with character array inserted into the char sequence of this str
|
FastStr |
insert(int index,
char character)
Return a new str with character inserted into the char sequence of this str
|
FastStr |
insert(int index,
Character... ca)
Return a new str with character array inserted into the char sequence of this str
|
FastStr |
insert(int index,
Character character)
Return a new str with character inserted into the char sequence of this str
|
FastStr |
insert(int index,
StrBase<?> str)
Returns a new str with a string specified inserted into the char sequence of this str
|
FastStr |
insert(int index,
String s)
Returns a new str with a string specified inserted into the char sequence of this str
|
String |
intern()
Wrapper of
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(FastStr 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 |
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 |
length() |
FastStr |
lpad(char c,
int times)
Alias of
StrBase.padLeft(char, int) |
FastStr |
lpad(int times)
Alias of
StrBase.padLeft(int) |
boolean |
matches(String regex)
Wrapper of
String.matches(String) |
static FastStr |
of(byte[] bytes,
String encoding) |
static FastStr |
of(char[] ca)
Construct a FastStr from a char array
|
static FastStr |
of(CharSequence cs)
Construct a FastStr from a CharSequence
|
static FastStr |
of(Collection<Character> col)
Construct a FastStr instance from a collection of characters
|
static FastStr |
of(Iterable<Character> itr)
Construct a FastStr instance from an iterable of characters
|
static FastStr |
of(Iterator<Character> itr)
Construct a FastStr instance from an iterator of characters
|
static FastStr |
of(String s)
Construct a FastStr from a String
|
static FastStr |
of(StringBuffer sb)
Construct a FastStr from a StringBuffer
|
static FastStr |
of(StringBuilder sb)
Construct a FastStr from a StringBuilder
|
FastStr |
padLeft(char c,
int times)
Returns a str instance with
times of char c left pad to the current str |
FastStr |
padLeft(int times)
Returns a str instance with
times of char ' ' (space) left pad to the current str |
FastStr |
padRight(char c,
int times)
Returns a str instance with
times of char c right pad to the current str |
FastStr |
padRight(int times)
Returns a str instance with
times of char ' ' (space) right pad to the current str |
FastStr |
parallel()
Returns this traversable and make sure
C.Feature.PARALLEL is set |
FastStr |
prepend(C.List<Character> list)
Return a str instance contains all characters of this str instance prepended with all characters in the list specified
|
FastStr |
prepend(char... chars)
Return a str instance contains all characters of this str instance prepended with all characters in the array specified
|
FastStr |
prepend(Character character)
Returns a str instance contains all characters of this str instance prepended with the character specified
|
FastStr |
prepend(Collection<? extends Character> collection)
Returns a str instance contains all characters of this str instance prepended with all characters in teh collection
|
FastStr |
prepend(FastStr s)
Returns a str instance contains all characters of this str instance prepended with all characters in the str specified
|
FastStr |
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,
FastStr other,
int ooffset,
int len)
Tests if two string regions are equal.
|
FastStr |
remove(Lang.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
|
FastStr |
replace(char oldChar,
char newChar)
Wrapper of
String.replace(char, char) but return FastStr instance |
FastStr |
replace(CharSequence target,
CharSequence replacement)
Wrapper of
String.replace(CharSequence, CharSequence) but return FastStr type instance |
FastStr |
replaceAll(String regex,
String replacement)
Wrapper of
String.replaceAll(String, String) but return FastStr type instance |
FastStr |
replaceFirst(String regex,
String replacement)
Wrapper of
String.replaceFirst(String, String) but return FastStr inance |
FastStr |
reverse()
Returns a str that contains all characters in this str instance but in a reversed order.
|
FastStr |
rpad(char c,
int times)
Alias of
StrBase.padRight(char, int) |
FastStr |
rpad(int times)
Alias of
StrBase.padRight(int) |
C.List<FastStr> |
split(String regex,
int limit)
Wrapper of
String.split(String, int) but return an immutable List of FastStr instances |
boolean |
startsWith(CharSequence suffix,
int toffset)
Check if this str starts with a char sequence, with the search starts at the specified offset
|
boolean |
startsWith(FastStr prefix,
int toffset)
Check this str instance starts with str, with the search starts at specified offset
|
FastStr |
strip(FastStr prefix,
FastStr suffix) |
FastStr |
strip(String prefix,
String suffix) |
FastStr |
subList(int fromIndex,
int toIndex)
Returns a sub str that is a part of this str
|
FastStr |
subSequence(int start,
int end)
Return a part of this str specified by start inclusive and end exclusive position.
|
String |
substring(int beginIndex)
Wrapper of
String.substring(int) |
String |
substring(int beginIndex,
int endIndex)
Wrapper of
String.substring(int, int) |
FastStr |
takeWhile(Lang.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.
|
FastStr |
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 |
FastStr |
toLowerCase(Locale locale)
Wrapper of
String.toLowerCase(java.util.Locale) but return FastStr type instance |
String |
toString() |
FastStr |
toUpperCase(Locale locale)
Wrapper of
String.toUpperCase(java.util.Locale) but return FastStr type instance |
FastStr |
trim()
Wrapper of
String.trim() and return FastStr type instance |
char[] |
unsafeChars()
Return char array buf of this FastStr instance.
|
static FastStr |
unsafeOf(char[] buf)
Construct a FastStr instance from char array without array copying
|
static FastStr |
unsafeOf(char[] buf,
int start,
int end)
Construct a FastStr instance from char array, from the start position, finished at end position without copying the array.
|
static FastStr |
unsafeOf(String s)
Construct a FastStr instance from a String instance.
|
FastStr |
urlEncode() |
accept, acceptLeft, acceptRight, add, after, after, before, before, concat, concat, contains, contentEquals, copy, count, count, countWithOverlap, countWithOverlap, cutOff, drop, eager, empty, endsWith, endsWith, eq, eq, eq, filter, flatMap, get, head, indexOf, indexOf, indexOf, indexOf, indexOf, indexOf, initFeatures, lastIndexOf, lastIndexOf, lastIndexOf, lastIndexOf, lastIndexOf, lastIndexOf, lazy, listIterator, lower, lower, map, maxLength, notEmpty, 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, asList, collect, 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, toMap, toMapByKey, toMapByVal, 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 FastStr EMPTY_STR
protected Class<FastStr> _impl()
StrBaseReturn the class of the implementation
public int length()
length in interface CharSequencepublic boolean isEmpty()
C.TraversableIs this traversal empty?
isEmpty 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()
StrBaseCheck if this str is blank (empty or all space characters)
public FastStr subList(int fromIndex, int toIndex)
StrBaseReturns a sub str that is a part of this str
subList in interface List<Character>subList in interface C.List<Character>subList in class StrBase<FastStr>fromIndex - the from (inclusive)toIndex - the to (exclusive)fromIndex and end at (@code toIndex)StrBase.subSequence(int, int),
StrBase.substr(int, int)public FastStr takeWhile(Lang.Function<? super Character,Boolean> predicate)
StrBaseReturn 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. The match operation stop at the first character that does not match the predicate
takeWhile in interface C.List<Character>takeWhile in interface C.ReversibleSequence<Character>takeWhile in interface C.Sequence<Character>takeWhile in class StrBase<FastStr>predicate - test if the character should be put into the new str or should stop matchingpublic FastStr dropWhile(Lang.Function<? super Character,Boolean> predicate)
StrBaseReturn a str that without the first N characters in the string. The characters been dropped must matches the test specified by teh predicate function. The match operation stop at the first character that matches the predicate
dropWhile in interface C.List<Character>dropWhile in interface C.ReversibleSequence<Character>dropWhile in interface C.Sequence<Character>dropWhile in class StrBase<FastStr>predicate - the function test if character should be dropped in the new str or stop match operationpublic FastStr remove(Lang.Function<? super Character,Boolean> predicate)
StrBaseReturns a str that with all characters in this str instance except those matches the test of predicate function specified
public FastStr insert(int index, char character) throws StringIndexOutOfBoundsException
StrBaseReturn a new str with character inserted into the char sequence of this str
insert in class StrBase<FastStr>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 FastStr insert(int index, Character character) throws StringIndexOutOfBoundsException
StrBaseReturn a new str with character inserted into the char sequence of this str
insert in interface C.List<Character>insert in class StrBase<FastStr>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 FastStr insert(int index, StrBase<?> str) throws StringIndexOutOfBoundsException
StrBaseReturns a new str with a string specified inserted into the char sequence of this str
insert in class StrBase<FastStr>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 FastStr insert(int index, Character... ca) throws StringIndexOutOfBoundsException
StrBaseReturn a new str with character array inserted into the char sequence of this str
insert in interface C.List<Character>insert in class StrBase<FastStr>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 FastStr insert(int index, char... ca) throws StringIndexOutOfBoundsException
StrBaseReturn a new str with character array inserted into the char sequence of this str
insert in class StrBase<FastStr>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 FastStr insert(int index, String s) throws StringIndexOutOfBoundsException
StrBaseReturns a new str with a string specified inserted into the char sequence of this str
insert in class StrBase<FastStr>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 FastStr reverse()
StrBaseReturns a str that contains all characters in this str instance but in a reversed order.
reverse in interface C.List<Character>reverse in interface C.ReversibleSequence<Character>reverse in class StrBase<FastStr>C.Feature.LIMITED,
C.Featured.is(org.osgl.util.C.Feature)public FastStr append(Collection<? extends Character> collection)
StrBaseReturn a str instance contains all characters of this str append with all characters in the collection specified
public FastStr append(C.List<Character> list)
StrBaseReturn a str instance contains all characters of this str instance append with all characters in the list specified
public FastStr parallel()
C.ListReturns this traversable and make sure C.Feature.PARALLEL is set
parallel in interface C.List<Character>parallel in interface C.ReversibleSequence<Character>parallel in interface C.Sequence<Character>parallel in interface C.Traversable<Character>parallel in class StrBase<FastStr>public FastStr append(char... array)
StrBaseReturn a str instance contains all characters of this str instance append with all characters in the array specified
public FastStr append(Character character)
StrBaseReturns a str instance contains all characters of this str instance appended with the character specified
append in interface C.List<Character>append in interface C.ReversibleSequence<Character>append in interface C.Sequence<Character>append in class StrBase<FastStr>character - the character to be appendedpublic FastStr append(FastStr s)
StrBaseReturns a str instance contains all characters of this str instance appended with all characters in teh str specified
public FastStr append(String s)
StrBaseReturns a str instance contains all characters of this str instance appended with all characters in the String specified
public FastStr prepend(Collection<? extends Character> collection)
StrBaseReturns a str instance contains all characters of this str instance prepended with all characters in teh collection
public FastStr prepend(C.List<Character> list)
StrBaseReturn a str instance contains all characters of this str instance prepended with all characters in the list specified
public FastStr prepend(char... chars)
StrBaseReturn a str instance contains all characters of this str instance prepended with all characters in the array specified
public FastStr prepend(Character character)
StrBaseReturns a str instance contains all characters of this str instance prepended with the character specified
prepend in interface C.List<Character>prepend in interface C.ReversibleSequence<Character>prepend in interface C.Sequence<Character>prepend in class StrBase<FastStr>character - the character to be preppendedpublic FastStr prepend(FastStr s)
StrBaseReturns a str instance contains all characters of this str instance prepended with all characters in the str specified
public FastStr prepend(String s)
StrBaseReturns a str instance contains all characters of this str instance prepended with all characters in the String specified
public FastStr padLeft(char c, int times)
StrBaseReturns a str instance with times of char c left pad to the current str
public FastStr lpad(char c, int times)
StrBaseAlias of StrBase.padLeft(char, int)
public FastStr padLeft(int times)
StrBaseReturns a str instance with times of char ' ' (space) left pad to the current str
public FastStr lpad(int times)
StrBaseAlias of StrBase.padLeft(int)
public FastStr padRight(char c, int times)
StrBaseReturns a str instance with times of char c right pad to the current str
public FastStr rpad(char c, int times)
StrBaseAlias of StrBase.padRight(char, int)
public FastStr padRight(int times)
StrBaseReturns a str instance with times of char ' ' (space) right pad to the current str
public FastStr rpad(int times)
StrBaseAlias of StrBase.padRight(int)
public char charAt(int index)
charAt in interface CharSequencepublic FastStr subSequence(int start, int end)
StrBaseReturn a part of this str specified by start inclusive and end exclusive position.
Note 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<FastStr>start - the start positionend - the end positionStrBase.subList(int, int),
StrBase.substr(int, int)public FastStr copy()
StrBaseReturns a copy of this str. The char buf is copied
public FastStr times(int n)
StrBaseReturns a str instance that repeat this str’s char sequence for n times
public FastStr canonical()
public int compareTo(FastStr o)
compareTo in interface Comparable<FastStr>public String toString()
toString in interface CharSequencetoString in class AbstractCollection<Character>public FastStr toFastStr()
StrBaseReturn a FastStr that contains all the char sequence in this str instance
public boolean equals(Object o)
public int hashCode()
public void getChars(int srcBegin,
int srcEnd,
char[] dst,
int dstBegin)
StrBaseCopy part of the char sequence into another array
public byte[] getBytes()
StrBaseEncodes this str into a sequence of bytes using the platform’s default charset, storing the result into a new byte array.
getBytes in class StrBase<FastStr>String.getBytes()public byte[] getBytes(String charsetName)
StrBaseEncodes this str into a sequence of bytes using the named charset, storing the result into a new byte array.
getBytes in class StrBase<FastStr>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)
StrBaseEncodes this str into a sequence of bytes using the given charset, storing the result into a new byte array.
getBytes in class StrBase<FastStr>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()
StrBaseReturns byte array of string composed of only ascii chars
getBytesAscII in class StrBase<FastStr>public byte[] getBytesUTF8()
StrBaseReturns byte array of string composed of UTF-8 chars
getBytesUTF8 in class StrBase<FastStr>public boolean contentEquals(CharSequence x)
Wrapper of String.contentEquals(CharSequence)
contentEquals in class StrBase<FastStr>x - the char sequence to be comparedpublic boolean contentEquals(FastStr x)
StrBaseCheck if this str content iks equals to the str specified
contentEquals in class StrBase<FastStr>x - the str instancetrue if content of this str equals to that of the strpublic boolean equalsIgnoreCase(CharSequence x)
Wrapper of String.equalsIgnoreCase(String)
equalsIgnoreCase in class StrBase<FastStr>x - the char sequence to be comparedtrue if the argument is not null and it represents an equivalent String ignoring case; false otherwisepublic boolean equalsIgnoreCase(FastStr x)
public int compareTo(CharSequence x)
StrBaseCompare the char sequence specified against this str
compareTo in class StrBase<FastStr>x - the char sequence to be compared to this strString.compareTo(String)public int compareToIgnoreCase(FastStr o)
StrBaseCompare the str specified against this str in a case insensitive manner
compareToIgnoreCase in class StrBase<FastStr>o - the str to be compared to this strString.compareToIgnoreCase(String)public int compareToIgnoreCase(CharSequence o)
StrBaseCompare the char sequence specified against this str in a case insensitive manner
compareToIgnoreCase in class StrBase<FastStr>o - the char sequence to be compared to this strString.compareToIgnoreCase(String)public boolean regionMatches(boolean ignoreCase,
int toffset,
FastStr other,
int ooffset,
int len)
StrBaseTests if two string regions are equal.
regionMatches in class StrBase<FastStr>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)
StrBaseTests if two string regions are equal.
regionMatches in class StrBase<FastStr>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(FastStr prefix, int toffset)
StrBaseCheck this str instance starts with str, with the search starts at specified offset
startsWith in class StrBase<FastStr>prefix - the str argumentstoffset - the offset where the search beginstrue if the search matches or false otherwisepublic boolean startsWith(CharSequence suffix, int toffset)
StrBaseCheck if this str starts with a char sequence, with the search starts at the specified offset
startsWith in class StrBase<FastStr>suffix - the char sequence argumenttoffset - the start offset where search beginstrue if search matches or false otherwisepublic boolean endsWith(CharSequence suffix, int toffset)
StrBaseCheck if this str ends with a char sequence, with the search starts at the specified offset
public boolean endsWith(FastStr prefix, int toffset)
StrBaseCheck this str instance ends with str, with the search starts at specified offset
public int indexOf(int ch,
int fromIndex)
StrBaseReturns the index within this str of the first occurrence of the specified character.
indexOf in class StrBase<FastStr>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)
StrBaseReturns the index within this str of the last occurrence of the specified character, searching backward starting at the specified index.
lastIndexOf in class StrBase<FastStr>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)
StrBaseReturns the index within this str of the first occurrence of the specified substring, starting at the specified index.
indexOf in class StrBase<FastStr>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(FastStr str, int fromIndex)
StrBaseLocate another str inside this str, start at the specified index
public int lastIndexOf(CharSequence str, int fromIndex)
StrBaseReturns the index within this str of the last occurrence of the specified substring, searching backward starting at the specified index.
The 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<FastStr>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(FastStr str, int fromIndex)
StrBaseReturns the index within this str of the last occurrence of the specified str, searching backward starting at the specified index.
The 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<FastStr>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)
Wrapper of String.substring(int)
public String substring(int beginIndex, int endIndex)
Wrapper of String.substring(int, int)
substring in class StrBase<FastStr>beginIndex - begin indexendIndex - end indexString.substring(int, int)public FastStr replace(char oldChar, char newChar)
Wrapper of String.replace(char, char) but return FastStr instance
public boolean matches(String regex)
Wrapper of String.matches(String)
matches in class StrBase<FastStr>regex - the regular expression to checked against this FastStrtrue if this FastStr matches regexPattern,
String.matches(String)public boolean contains(CharSequence s)
Wrapper of String.contains(CharSequence)
public FastStr replaceFirst(String regex, String replacement)
Wrapper of String.replaceFirst(String, String) but return FastStr inance
replaceFirst in class StrBase<FastStr>regex - the regular expression specifies the place to be replacedreplacement - the string to replace the found partPattern,
String.replaceFirst(String, String)public FastStr replaceAll(String regex, String replacement)
Wrapper of String.replaceAll(String, String) but return FastStr type instance
replaceAll in class StrBase<FastStr>regex - the regular expression specifies the pattern to be replacedreplacement - the replacement stringPattern,
String.replaceAll(String, String)public FastStr replace(CharSequence target, CharSequence replacement)
Wrapper of String.replace(CharSequence, CharSequence) but return FastStr type instance
public C.List<FastStr> split(String regex, int limit)
Wrapper of String.split(String, int) but return an immutable List of FastStr instances
public FastStr toLowerCase(Locale locale)
Wrapper of String.toLowerCase(java.util.Locale) but return FastStr type instance
toLowerCase in class StrBase<FastStr>locale - the localepublic FastStr toUpperCase(Locale locale)
Wrapper of String.toUpperCase(java.util.Locale) but return FastStr type instance
toUpperCase in class StrBase<FastStr>locale - the localepublic FastStr trim()
Wrapper of String.trim() and return FastStr type instance
public char[] charArray()
Alias of StrBase.toCharArray()
public char[] unsafeChars()
Return char array buf of this FastStr instance. Note this method might return the char array buf directly without copy operation
public String intern()
Wrapper of String.intern()
public FastStr afterFirst(String s)
afterFirst in class StrBase<FastStr>public FastStr afterFirst(FastStr s)
afterFirst in class StrBase<FastStr>public FastStr afterFirst(char c)
afterFirst in class StrBase<FastStr>public FastStr beforeFirst(String s)
beforeFirst in class StrBase<FastStr>public FastStr beforeLast(String s)
beforeLast in class StrBase<FastStr>public FastStr beforeFirst(FastStr s)
beforeFirst in class StrBase<FastStr>public FastStr beforeLast(FastStr s)
beforeLast in class StrBase<FastStr>public FastStr beforeFirst(char c)
beforeFirst in class StrBase<FastStr>public FastStr beforeLast(char c)
beforeLast in class StrBase<FastStr>public FastStr decodeBASE64()
decodeBASE64 in class StrBase<FastStr>public FastStr encodeBASE64()
encodeBASE64 in class StrBase<FastStr>public int count(String search, boolean overlap)
public int count(FastStr search, boolean overlap)
public static FastStr of(char[] ca)
Construct a FastStr from a char array
ca - the char arraypublic static FastStr of(CharSequence cs)
Construct a FastStr from a CharSequence
cs - the CharSequence instancepublic static FastStr of(String s)
Construct a FastStr from a String
s - the Stringpublic static FastStr of(StringBuilder sb)
Construct a FastStr from a StringBuilder
sb - the string builderpublic static FastStr of(StringBuffer sb)
Construct a FastStr from a StringBuffer
sb - the string bufferpublic static FastStr of(Iterable<Character> itr)
Construct a FastStr instance from an iterable of characters
itr - the character iterablepublic static FastStr of(Collection<Character> col)
Construct a FastStr instance from a collection of characters
col - the character collectionpublic static FastStr of(Iterator<Character> itr)
Construct a FastStr instance from an iterator of characters
itr - the character iteratorpublic static FastStr unsafeOf(String s)
Construct a FastStr instance from a String instance. The FastStr instance will share the char array buf with the String instance
s - the string instancepublic static FastStr unsafeOf(char[] buf)
Construct a FastStr instance from char array without array copying
buf - the char arraypublic static FastStr unsafeOf(char[] buf, int start, int end)
Construct a FastStr instance from char array, from the start position, finished at end position without copying the array. This method might use the array directly instead of copying elements from the array. Thus it is extremely important that the array buf passed in will NOT be updated outside the FastStr instance.
buf - the char arraystart - the start position (inclusive)end - the end position (exclusive)public static char[] bufOf(CharSequence chars)
Return the char array that backed the char sequence specified
chars - the char sequenceCopyright © 2014–2019 OSGL (Open Source General Library). All rights reserved.