public final class AsciiString extends Object implements CharSequence, Comparable<CharSequence>
String
, which uses a character array, for
reduced memory footprint and faster data transfer from/to byte-based data structures such as a byte array and
ByteBuffer
. It is often used in conjunction with Headers
that require a CharSequence
.
This class was designed to provide an immutable array of bytes, and caches some internal state based upon the value
of this array. However underlying access to this byte array is provided via not copying the array on construction or
array()
. If any changes are made to the underlying byte array it is the user's responsibility to call
arrayChanged()
so the state of this class can be reset.
Modifier and Type | Field and Description |
---|---|
static HashingStrategy<CharSequence> |
CASE_INSENSITIVE_HASHER |
static HashingStrategy<CharSequence> |
CASE_SENSITIVE_HASHER |
static AsciiString |
EMPTY_STRING |
static int |
INDEX_NOT_FOUND |
Constructor and Description |
---|
AsciiString(byte[] value)
Initialize this byte string based upon a byte array.
|
AsciiString(byte[] value,
boolean copy)
Initialize this byte string based upon a byte array.
|
AsciiString(byte[] value,
int start,
int length,
boolean copy)
Construct a new instance from a
byte[] array. |
AsciiString(ByteBuffer value)
Create a copy of the underlying storage from
value . |
AsciiString(ByteBuffer value,
boolean copy)
Initialize an instance based upon the underlying storage from
value . |
AsciiString(ByteBuffer value,
int start,
int length,
boolean copy)
Initialize an
AsciiString based upon the underlying storage from value . |
AsciiString(char[] value)
Create a copy of
value into this instance assuming ASCII encoding. |
AsciiString(char[] value,
Charset charset)
Create a copy of
value into this instance using the encoding type of charset . |
AsciiString(char[] value,
Charset charset,
int start,
int length)
Create a copy of
value into a this instance using the encoding type of charset . |
AsciiString(char[] value,
int start,
int length)
Create a copy of
value into this instance assuming ASCII encoding. |
AsciiString(CharSequence value)
Create a copy of
value into this instance assuming ASCII encoding. |
AsciiString(CharSequence value,
Charset charset)
Create a copy of
value into this instance using the encoding type of charset . |
AsciiString(CharSequence value,
Charset charset,
int start,
int length)
Create a copy of
value into this instance using the encoding type of charset . |
AsciiString(CharSequence value,
int start,
int length)
Create a copy of
value into this instance assuming ASCII encoding. |
Modifier and Type | Method and Description |
---|---|
byte[] |
array()
This gives direct access to the underlying storage array.
|
void |
arrayChanged()
During normal use cases the
AsciiString should be immutable, but if the underlying array is shared,
and changes then this needs to be called. |
int |
arrayOffset()
The offset into
array() for which data for this ByteString begins. |
static char |
b2c(byte b) |
byte |
byteAt(int index) |
static byte |
c2b(char c) |
static AsciiString |
cached(String string)
Returns an
AsciiString containing the given string and retains/caches the input
string for later use in toString() . |
char |
charAt(int index) |
int |
compareTo(CharSequence string)
Compares the specified string to this string using the ASCII values of the characters.
|
AsciiString |
concat(CharSequence string)
Concatenates this string and the specified string.
|
boolean |
contains(CharSequence cs)
Determines if this
String contains the sequence of characters in the CharSequence passed. |
static boolean |
contains(CharSequence a,
CharSequence b)
Determine if
a contains b in a case sensitive manner. |
static boolean |
containsAllContentEqualsIgnoreCase(Collection<CharSequence> a,
Collection<CharSequence> b)
Determine if
a contains all of the values in b using
contentEqualsIgnoreCase(CharSequence, CharSequence) to compare values. |
static boolean |
containsContentEqualsIgnoreCase(Collection<CharSequence> collection,
CharSequence value)
Determine if
collection contains value and using
contentEqualsIgnoreCase(CharSequence, CharSequence) to compare values. |
static boolean |
containsIgnoreCase(CharSequence a,
CharSequence b)
Determine if
a contains b in a case insensitive manner. |
boolean |
contentEquals(CharSequence a)
Compares a
CharSequence to this String to determine if their contents are equal. |
static boolean |
contentEquals(CharSequence a,
CharSequence b)
Returns
true if the content of both CharSequence 's are equals. |
boolean |
contentEqualsIgnoreCase(CharSequence string)
Compares the specified string to this string ignoring the case of the characters and returns true if they are
equal.
|
static boolean |
contentEqualsIgnoreCase(CharSequence a,
CharSequence b)
Returns
true if both CharSequence 's are equals when ignore the case. |
void |
copy(int srcIdx,
byte[] dst,
int dstIdx,
int length)
Copies the content of this string to a byte array.
|
void |
copy(int srcIdx,
char[] dst,
int dstIdx,
int length)
Copied the content of this string to a character array.
|
boolean |
endsWith(CharSequence suffix)
Compares the specified string to this string to determine if the specified string is a suffix.
|
boolean |
equals(Object obj) |
int |
forEachByte(ByteProcessor visitor)
Iterates over the readable bytes of this buffer with the specified
processor in ascending order. |
int |
forEachByte(int index,
int length,
ByteProcessor visitor)
Iterates over the specified area of this buffer with the specified
processor in ascending order. |
int |
forEachByteDesc(ByteProcessor visitor)
Iterates over the readable bytes of this buffer with the specified
processor in descending order. |
int |
forEachByteDesc(int index,
int length,
ByteProcessor visitor)
Iterates over the specified area of this buffer with the specified
processor in descending order. |
int |
hashCode()
Provides a case-insensitive hash code for Ascii like byte strings.
|
static int |
hashCode(CharSequence value)
Returns the case-insensitive hash code of the specified string.
|
int |
indexOf(char ch,
int start)
Searches in this string for the index of the specified char
ch . |
int |
indexOf(CharSequence string)
Searches in this string for the first index of the specified string.
|
static int |
indexOf(CharSequence cs,
char searchChar,
int start)
Finds the first index in the
CharSequence that matches the
specified character. |
int |
indexOf(CharSequence subString,
int start)
Searches in this string for the index of the specified string.
|
static int |
indexOfIgnoreCase(CharSequence str,
CharSequence searchStr,
int startPos)
Case in-sensitive find of the first index within a CharSequence
from the specified position.
|
static int |
indexOfIgnoreCaseAscii(CharSequence str,
CharSequence searchStr,
int startPos)
Case in-sensitive find of the first index within a CharSequence
from the specified position.
|
boolean |
isEmpty()
Determine if this instance has 0 length.
|
boolean |
isEntireArrayUsed()
Determine if the storage represented by
array() is entirely used. |
static boolean |
isUpperCase(byte value) |
static boolean |
isUpperCase(char value) |
int |
lastIndexOf(CharSequence string)
Searches in this string for the last index of the specified string.
|
int |
lastIndexOf(CharSequence subString,
int start)
Searches in this string for the index of the specified string.
|
int |
length()
The length in bytes of this instance.
|
boolean |
matches(String expr)
Determines whether this string matches a given regular expression.
|
static AsciiString |
of(CharSequence string)
Returns an
AsciiString containing the given character sequence. |
boolean |
parseBoolean() |
char |
parseChar() |
char |
parseChar(int start) |
double |
parseDouble() |
double |
parseDouble(int start,
int end) |
float |
parseFloat() |
float |
parseFloat(int start,
int end) |
int |
parseInt() |
int |
parseInt(int radix) |
int |
parseInt(int start,
int end) |
int |
parseInt(int start,
int end,
int radix) |
long |
parseLong() |
long |
parseLong(int radix) |
long |
parseLong(int start,
int end) |
long |
parseLong(int start,
int end,
int radix) |
short |
parseShort() |
short |
parseShort(int radix) |
short |
parseShort(int start,
int end) |
short |
parseShort(int start,
int end,
int radix) |
boolean |
regionMatches(boolean ignoreCase,
int thisStart,
CharSequence string,
int start,
int length)
Compares the specified string to this string and compares the specified range of characters to determine if they
are the same.
|
static boolean |
regionMatches(CharSequence cs,
boolean ignoreCase,
int csStart,
CharSequence string,
int start,
int length)
This methods make regionMatches operation correctly for any chars in strings
|
boolean |
regionMatches(int thisStart,
CharSequence string,
int start,
int length)
Compares the specified string to this string and compares the specified range of characters to determine if they
are the same.
|
static boolean |
regionMatchesAscii(CharSequence cs,
boolean ignoreCase,
int csStart,
CharSequence string,
int start,
int length)
This is optimized version of regionMatches for string with ASCII chars only
|
AsciiString |
replace(char oldChar,
char newChar)
Copies this string replacing occurrences of the specified character with another character.
|
AsciiString[] |
split(char delim)
Splits the specified
String with the specified delimiter.. |
AsciiString[] |
split(String expr,
int max)
Splits this string using the supplied regular expression
expr . |
boolean |
startsWith(CharSequence prefix)
Compares the specified string to this string to determine if the specified string is a prefix.
|
boolean |
startsWith(CharSequence prefix,
int start)
Compares the specified string to this string, starting at the specified offset, to determine if the specified
string is a prefix.
|
AsciiString |
subSequence(int start)
Copies a range of characters into a new string.
|
AsciiString |
subSequence(int start,
int end)
Copies a range of characters into a new string.
|
AsciiString |
subSequence(int start,
int end,
boolean copy)
Either copy or share a subset of underlying sub-sequence of bytes.
|
byte[] |
toByteArray()
Converts this string to a byte array.
|
byte[] |
toByteArray(int start,
int end)
Converts a subset of this string to a byte array.
|
char[] |
toCharArray()
Copies the characters in this string to a character array.
|
char[] |
toCharArray(int start,
int end)
Copies the characters in this string to a character array.
|
AsciiString |
toLowerCase()
Converts the characters in this string to lowercase, using the default Locale.
|
static char |
toLowerCase(char c)
If the character is uppercase - converts the character to lowercase,
otherwise returns the character as it is.
|
String |
toString()
Translates the entire byte string to a
String . |
String |
toString(int start)
Translates the entire byte string to a
String using the charset encoding. |
String |
toString(int start,
int end)
|
AsciiString |
toUpperCase()
Converts the characters in this string to uppercase, using the default Locale.
|
AsciiString |
trim()
Duplicates this string removing white space characters from the beginning and end of the
string, without copying.
|
static CharSequence |
trim(CharSequence c)
Copies this string removing white space characters from the beginning and end of the string, and tries not to
copy if possible.
|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
chars, codePoints
public static final AsciiString EMPTY_STRING
public static final int INDEX_NOT_FOUND
public static final HashingStrategy<CharSequence> CASE_INSENSITIVE_HASHER
public static final HashingStrategy<CharSequence> CASE_SENSITIVE_HASHER
public AsciiString(byte[] value)
public AsciiString(byte[] value, boolean copy)
copy
determines if a copy is made or the array is shared.public AsciiString(byte[] value, int start, int length, boolean copy)
byte[]
array.copy
- true
then a copy of the memory will be made. false
the underlying memory
will be shared.public AsciiString(ByteBuffer value)
value
.
The copy will start at Buffer.position()
and copy Buffer.remaining()
bytes.public AsciiString(ByteBuffer value, boolean copy)
value
.
There is a potential to share the underlying array storage if ByteBuffer.hasArray()
is true
.
if copy
is true
a copy will be made of the memory.
if copy
is false
the underlying storage will be shared, if possible.public AsciiString(ByteBuffer value, int start, int length, boolean copy)
AsciiString
based upon the underlying storage from value
.
There is a potential to share the underlying array storage if ByteBuffer.hasArray()
is true
.
if copy
is true
a copy will be made of the memory.
if copy
is false
the underlying storage will be shared, if possible.public AsciiString(char[] value)
value
into this instance assuming ASCII encoding.public AsciiString(char[] value, int start, int length)
value
into this instance assuming ASCII encoding.
The copy will start at index start
and copy length
bytes.public AsciiString(char[] value, Charset charset)
value
into this instance using the encoding type of charset
.public AsciiString(char[] value, Charset charset, int start, int length)
value
into a this instance using the encoding type of charset
.
The copy will start at index start
and copy length
bytes.public AsciiString(CharSequence value)
value
into this instance assuming ASCII encoding.public AsciiString(CharSequence value, int start, int length)
value
into this instance assuming ASCII encoding.
The copy will start at index start
and copy length
bytes.public AsciiString(CharSequence value, Charset charset)
value
into this instance using the encoding type of charset
.public AsciiString(CharSequence value, Charset charset, int start, int length)
value
into this instance using the encoding type of charset
.
The copy will start at index start
and copy length
bytes.public int forEachByte(ByteProcessor visitor) throws Exception
processor
in ascending order.-1
if the processor iterated to or beyond the end of the readable bytes.
The last-visited index If the ByteProcessor.process(byte)
returned false
.Exception
public int forEachByte(int index, int length, ByteProcessor visitor) throws Exception
processor
in ascending order.
(i.e. index
, (index + 1)
, .. (index + length - 1)
).-1
if the processor iterated to or beyond the end of the specified area.
The last-visited index If the ByteProcessor.process(byte)
returned false
.Exception
public int forEachByteDesc(ByteProcessor visitor) throws Exception
processor
in descending order.-1
if the processor iterated to or beyond the beginning of the readable bytes.
The last-visited index If the ByteProcessor.process(byte)
returned false
.Exception
public int forEachByteDesc(int index, int length, ByteProcessor visitor) throws Exception
processor
in descending order.
(i.e. (index + length - 1)
, (index + length - 2)
, ... index
).-1
if the processor iterated to or beyond the beginning of the specified area.
The last-visited index If the ByteProcessor.process(byte)
returned false
.Exception
public byte byteAt(int index)
public boolean isEmpty()
public int length()
length
in interface CharSequence
public void arrayChanged()
AsciiString
should be immutable, but if the underlying array is shared,
and changes then this needs to be called.public byte[] array()
toByteArray()
should be preferred over this method.
If the return value is changed then arrayChanged()
must be called.arrayOffset()
,
isEntireArrayUsed()
public int arrayOffset()
array()
for which data for this ByteString begins.array()
,
isEntireArrayUsed()
public boolean isEntireArrayUsed()
array()
is entirely used.array()
public byte[] toByteArray()
public byte[] toByteArray(int start, int end)
start
, end
).public void copy(int srcIdx, byte[] dst, int dstIdx, int length)
srcIdx
- the starting offset of characters to copy.dst
- the destination byte array.dstIdx
- the starting offset in the destination byte array.length
- the number of characters to copy.public char charAt(int index)
charAt
in interface CharSequence
public boolean contains(CharSequence cs)
String
contains the sequence of characters in the CharSequence
passed.cs
- the character sequence to search for.true
if the sequence of characters are contained in this string, otherwise false
.public int compareTo(CharSequence string)
compareTo
in interface Comparable<CharSequence>
string
- the string to compare.NullPointerException
- if string
is null
.public AsciiString concat(CharSequence string)
string
- the string to concatenatepublic boolean endsWith(CharSequence suffix)
suffix
- the suffix to look for.true
if the specified string is a suffix of this string, false
otherwise.NullPointerException
- if suffix
is null
.public boolean contentEqualsIgnoreCase(CharSequence string)
string
- the string to compare.true
if the specified string is equal to this string, false
otherwise.public char[] toCharArray()
public char[] toCharArray(int start, int end)
public void copy(int srcIdx, char[] dst, int dstIdx, int length)
srcIdx
- the starting offset of characters to copy.dst
- the destination character array.dstIdx
- the starting offset in the destination byte array.length
- the number of characters to copy.public AsciiString subSequence(int start)
start
- the offset of the first character (inclusive).IndexOutOfBoundsException
- if start < 0
or start > length()
.public AsciiString subSequence(int start, int end)
subSequence
in interface CharSequence
start
- the offset of the first character (inclusive).end
- The index to stop at (exclusive).IndexOutOfBoundsException
- if start < 0
or start > length()
.public AsciiString subSequence(int start, int end, boolean copy)
start
- the offset of the first character (inclusive).end
- The index to stop at (exclusive).copy
- If true
then a copy of the underlying storage will be made.
If false
then the underlying storage will be shared.IndexOutOfBoundsException
- if start < 0
or start > length()
.public int indexOf(CharSequence string)
string
- the string to find.NullPointerException
- if string
is null
.public int indexOf(CharSequence subString, int start)
subString
- the string to find.start
- the starting offset.NullPointerException
- if subString
is null
.public int indexOf(char ch, int start)
ch
.
The search for the char starts at the specified offset start
and moves towards the end of this string.ch
- the char to find.start
- the starting offset.ch
in this string,
-1 if found no occurrence.public int lastIndexOf(CharSequence string)
string
- the string to find.NullPointerException
- if string
is null
.public int lastIndexOf(CharSequence subString, int start)
subString
- the string to find.start
- the starting offset.NullPointerException
- if subString
is null
.public boolean regionMatches(int thisStart, CharSequence string, int start, int length)
thisStart
- the starting offset in this string.string
- the string to compare.start
- the starting offset in the specified string.length
- the number of characters to compare.true
if the ranges of characters are equal, false
otherwiseNullPointerException
- if string
is null
.public boolean regionMatches(boolean ignoreCase, int thisStart, CharSequence string, int start, int length)
ignoreCase
- specifies if case should be ignored.thisStart
- the starting offset in this string.string
- the string to compare.start
- the starting offset in the specified string.length
- the number of characters to compare.true
if the ranges of characters are equal, false
otherwise.NullPointerException
- if string
is null
.public AsciiString replace(char oldChar, char newChar)
oldChar
- the character to replace.newChar
- the replacement character.public boolean startsWith(CharSequence prefix)
prefix
- the string to look for.true
if the specified string is a prefix of this string, false
otherwiseNullPointerException
- if prefix
is null
.public boolean startsWith(CharSequence prefix, int start)
prefix
- the string to look for.start
- the starting offset.true
if the specified string occurs in this string at the specified offset, false
otherwise.NullPointerException
- if prefix
is null
.public AsciiString toLowerCase()
public AsciiString toUpperCase()
public static CharSequence trim(CharSequence c)
c
- The CharSequence
to trim.<= \\u0020
removed from the beginning and the end.public AsciiString trim()
<= \\u0020
removed from the beginning and the end.public boolean contentEquals(CharSequence a)
CharSequence
to this String
to determine if their contents are equal.a
- the character sequence to compare to.true
if equal, otherwise false
public boolean matches(String expr)
expr
- the regular expression to be matched.true
if the expression matches, otherwise false
.PatternSyntaxException
- if the syntax of the supplied regular expression is not valid.NullPointerException
- if expr
is null
.public AsciiString[] split(String expr, int max)
expr
. The parameter max
controls the
behavior how many times the pattern is applied to the string.expr
- the regular expression used to divide the string.max
- the number of entries in the resulting array.NullPointerException
- if expr
is null
.PatternSyntaxException
- if the syntax of the supplied regular expression is not valid.Pattern.split(CharSequence, int)
public AsciiString[] split(char delim)
String
with the specified delimiter..public int hashCode()
Provides a case-insensitive hash code for Ascii like byte strings.
public String toString()
String
.toString
in interface CharSequence
toString
in class Object
toString(int)
public String toString(int start)
String
using the charset
encoding.toString(int, int)
public String toString(int start, int end)
public boolean parseBoolean()
public char parseChar()
public char parseChar(int start)
public short parseShort()
public short parseShort(int radix)
public short parseShort(int start, int end)
public short parseShort(int start, int end, int radix)
public int parseInt()
public int parseInt(int radix)
public int parseInt(int start, int end)
public int parseInt(int start, int end, int radix)
public long parseLong()
public long parseLong(int radix)
public long parseLong(int start, int end)
public long parseLong(int start, int end, int radix)
public float parseFloat()
public float parseFloat(int start, int end)
public double parseDouble()
public double parseDouble(int start, int end)
public static AsciiString of(CharSequence string)
AsciiString
containing the given character sequence. If the given string is already a
AsciiString
, just returns the same instance.public static AsciiString cached(String string)
AsciiString
containing the given string and retains/caches the input
string for later use in toString()
.
Used for the constants (which already stored in the JVM's string table) and in cases
where the guaranteed use of the toString()
method.public static int hashCode(CharSequence value)
hashCode()
so that you can put both AsciiString
s and arbitrary
CharSequence
s into the same headers.public static boolean contains(CharSequence a, CharSequence b)
a
contains b
in a case sensitive manner.public static boolean containsIgnoreCase(CharSequence a, CharSequence b)
a
contains b
in a case insensitive manner.public static boolean contentEqualsIgnoreCase(CharSequence a, CharSequence b)
true
if both CharSequence
's are equals when ignore the case. This only supports 8-bit
ASCII.public static boolean containsContentEqualsIgnoreCase(Collection<CharSequence> collection, CharSequence value)
collection
contains value
and using
contentEqualsIgnoreCase(CharSequence, CharSequence)
to compare values.collection
- The collection to look for and equivalent element as value
.value
- The value to look for in collection
.true
if collection
contains value
according to
contentEqualsIgnoreCase(CharSequence, CharSequence)
. false
otherwise.contentEqualsIgnoreCase(CharSequence, CharSequence)
public static boolean containsAllContentEqualsIgnoreCase(Collection<CharSequence> a, Collection<CharSequence> b)
a
contains all of the values in b
using
contentEqualsIgnoreCase(CharSequence, CharSequence)
to compare values.a
- The collection under test.b
- The values to test for.true
if a
contains all of the values in b
using
contentEqualsIgnoreCase(CharSequence, CharSequence)
to compare values. false
otherwise.contentEqualsIgnoreCase(CharSequence, CharSequence)
public static boolean contentEquals(CharSequence a, CharSequence b)
true
if the content of both CharSequence
's are equals. This only supports 8-bit ASCII.public static boolean regionMatches(CharSequence cs, boolean ignoreCase, int csStart, CharSequence string, int start, int length)
cs
- the CharSequence
to be processedignoreCase
- specifies if case should be ignored.csStart
- the starting offset in the cs
CharSequencestring
- the CharSequence
to compare.start
- the starting offset in the specified string
.length
- the number of characters to compare.true
if the ranges of characters are equal, false
otherwise.public static boolean regionMatchesAscii(CharSequence cs, boolean ignoreCase, int csStart, CharSequence string, int start, int length)
cs
- the CharSequence
to be processedignoreCase
- specifies if case should be ignored.csStart
- the starting offset in the cs
CharSequencestring
- the CharSequence
to compare.start
- the starting offset in the specified string
.length
- the number of characters to compare.true
if the ranges of characters are equal, false
otherwise.public static int indexOfIgnoreCase(CharSequence str, CharSequence searchStr, int startPos)
Case in-sensitive find of the first index within a CharSequence from the specified position.
A null
CharSequence will return -1
.
A negative start position is treated as zero.
An empty ("") search CharSequence always matches.
A start position greater than the string length only matches
an empty search CharSequence.
AsciiString.indexOfIgnoreCase(null, *, *) = -1 AsciiString.indexOfIgnoreCase(*, null, *) = -1 AsciiString.indexOfIgnoreCase("", "", 0) = 0 AsciiString.indexOfIgnoreCase("aabaabaa", "A", 0) = 0 AsciiString.indexOfIgnoreCase("aabaabaa", "B", 0) = 2 AsciiString.indexOfIgnoreCase("aabaabaa", "AB", 0) = 1 AsciiString.indexOfIgnoreCase("aabaabaa", "B", 3) = 5 AsciiString.indexOfIgnoreCase("aabaabaa", "B", 9) = -1 AsciiString.indexOfIgnoreCase("aabaabaa", "B", -1) = 2 AsciiString.indexOfIgnoreCase("aabaabaa", "", 2) = 2 AsciiString.indexOfIgnoreCase("abc", "", 9) = -1
str
- the CharSequence to check, may be nullsearchStr
- the CharSequence to find, may be nullstartPos
- the start position, negative treated as zeronull
string inputpublic static int indexOfIgnoreCaseAscii(CharSequence str, CharSequence searchStr, int startPos)
Case in-sensitive find of the first index within a CharSequence from the specified position. This method optimized and works correctly for ASCII CharSequences only
A null
CharSequence will return -1
.
A negative start position is treated as zero.
An empty ("") search CharSequence always matches.
A start position greater than the string length only matches
an empty search CharSequence.
AsciiString.indexOfIgnoreCase(null, *, *) = -1 AsciiString.indexOfIgnoreCase(*, null, *) = -1 AsciiString.indexOfIgnoreCase("", "", 0) = 0 AsciiString.indexOfIgnoreCase("aabaabaa", "A", 0) = 0 AsciiString.indexOfIgnoreCase("aabaabaa", "B", 0) = 2 AsciiString.indexOfIgnoreCase("aabaabaa", "AB", 0) = 1 AsciiString.indexOfIgnoreCase("aabaabaa", "B", 3) = 5 AsciiString.indexOfIgnoreCase("aabaabaa", "B", 9) = -1 AsciiString.indexOfIgnoreCase("aabaabaa", "B", -1) = 2 AsciiString.indexOfIgnoreCase("aabaabaa", "", 2) = 2 AsciiString.indexOfIgnoreCase("abc", "", 9) = -1
str
- the CharSequence to check, may be nullsearchStr
- the CharSequence to find, may be nullstartPos
- the start position, negative treated as zeronull
string inputpublic static int indexOf(CharSequence cs, char searchChar, int start)
Finds the first index in the CharSequence
that matches the
specified character.
cs
- the CharSequence
to be processed, not nullsearchChar
- the char to be searched forstart
- the start index, negative starts at the string startsearchChar
is not found or cs == null
public static char toLowerCase(char c)
public static boolean isUpperCase(byte value)
public static boolean isUpperCase(char value)
public static byte c2b(char c)
public static char b2c(byte b)
Copyright © 2008–2024 The Netty Project. All rights reserved.