This inner class of AString provides static methods working with character arrays.
Public Static Fields | |
static final char[] | DEFAULT_WHITESPACES = {' ','\r','\n','\t' } |
static final String | EMPTY = "" |
static final String | NEW_LINE_CHARS =System.getProperty("line.separator") |
static final char[] | nullBuffer =new char[0] |
Public Static Methods | |
static boolean | adjustRegion (int referenceLength, int regionStart, int regionLength, int[] target) |
static int | compareTo (CharSequence needle, int needleStart, int needleLength, char[] haystack, int haystackStart, int haystackLength, Case sensitivity) |
static boolean | containsAt (char[] needle, int needleStart, int needleLength, char[] haystack, int haystackPos, int haystackLimit, Case sensitivity) |
static boolean | containsAt (CharSequence needle, char[] haystack, int haystackPos, int haystackLimit, Case sensitivity) |
static boolean | endsWithIgnoreCase (CharSequence haystack, CharSequence needle) |
static int | indexOf (char needle, char[] haystack) |
static int | indexOf (char needle, char[] haystack, int regionStart) |
static int | indexOf (char needle, char[] haystack, int regionStart, int regionLength) |
static int | indexOfAnyInRegion (char[] haystack, int regionStart, int regionLength, char[] needles, Inclusion inclusion) |
static int | indexOfFirstDifference (char[] haystack, int haystackStart, int haystackLength, CharSequence needle, Case sensitivity) |
static int | indexOfIgnoreCase (CharSequence haystack, CharSequence needle) |
static int | indexOfIgnoreCase (CharSequence haystack, CharSequence needle, int startIdx) |
static int | indexOfString (CharSequence needle, char[] haystack, int haystackStart, int haystackLength, Case sensitivity) |
static boolean | isNullOrEmpty (CharSequence cs) |
static int | lastIndexOfAny (char[] haystack, int regionStart, int regionLength, char[] needles, Inclusion inclusion) |
static boolean | startsWithIgnoreCase (CharSequence haystack, CharSequence needle) |
|
static |
Adjusts a given region to fit into the range [0 .. referenceLength].
referenceLength | Length of the string that the given region will be adjusted to. |
regionStart | The start of the region to be adjusted. |
regionLength | The length of the region to be adjusted. |
target | Array of size 2 that receives the target values. |
|
static |
Compares a given region of a CharSequence with a in a char[].
No parameter checks are performed. Null and empty checks and proper region bounds have to be provided (this is a helper method for other compareTo methods).
needle | An object of type CharSequence that is compared to haystack. |
needleStart | The start of the region in needle that is to be compared. |
needleLength | The length of the region in needle. |
haystack | The character buffer that is compared. |
haystackStart | The start of the substring within haystack. |
haystackLength | The length of the substring within haystack. |
sensitivity | Case sensitivity of the operation. |
|
static |
Checks if a region of a char[] is located at the given position of another char[].
needle | The character array containing the needle. |
needleStart | The index of the start of the needle within the character array. |
needleLength | The length of the needle within the character array. |
haystack | The character array to look in for the needle. |
haystackPos | The position to look at in haystack. |
haystackLimit | The length of the haystack (may be equal or less than haystack.length(). |
sensitivity | Case sensitivity of the comparison. |
true
if the needle is found at the given position. false
otherwise.
|
static |
Checks if a CharSequence is located in a char[] at the given position.
needle | The string to search. |
haystack | The character array to look in for the needle. |
haystackPos | The position to look at in haystack. |
haystackLimit | The length of the haystack (may be equal or less than haystack.length(). |
sensitivity | Case sensitivity of the comparison. |
true
if the sequence is found at the given position. false
otherwise.
|
static |
Static utility function to check if a string ends with another string with case insensitive compare. Using this function avoids to create two converted (lowered) temporary strings.
haystack | The CharSequence to search in. |
needle | The CharSequence to search for. |
|
static |
Static method that searches a character in a character array.
needle | The character to be searched for. |
haystack | Character array that is searched in. |
|
static |
Static method that searches a character in a character array, starting at a given index to the end of the array.
needle | The character to be searched for. |
haystack | Character array that is searched in. |
regionStart | The start of the region within haystack. Defaults to 0. |
|
static |
Static method that searches a character in a region of a character array.
needle | The character to be searched for. |
haystack | Character array that is searched in. |
regionStart | The start of the region within haystack. Defaults to 0. |
regionLength | The length of the region within haystack. Defaults to Integer.MAX_VALUE. |
|
static |
Static method that returns the index of the first character which is included (alternatively not included) in a given set of characters.
This method searches from left to right. For backward search, see lastIndexOfAny
haystack | The string to be searched. |
regionStart | The start of the region within haystack. |
regionLength | The length of the region within haystack. |
needles | Characters to be searched for. |
inclusion | Denotes whether the search returns the first index that holds a value that is included or that is not excluded in the set of needle characters. |
|
static |
Static method that returns the index of the first character which not equal within two strings. If haystack starts with needle, then the length of needle is returned.
haystack | Character array that is searched in. |
haystackStart | The start of the region within haystack. |
haystackLength | The length of the region within haystack. |
needle | The string to be searched for. |
sensitivity | The sensitivity to the case of characters of the operation. |
|
static |
Search the given String in the Buffer.
haystack | The CharSequence to search in. |
needle | The CharSequence to search for. |
|
static |
Search a string within another starting at a given position.
haystack | The CharSequence to search in. |
needle | The CharSequence to search for. |
startIdx | The index to start the search at. Optional and defaults to 0 . |
|
static |
Searches a CharSequence in a region of a character array.
needle | The CharSequence to search. |
haystack | Character array that is searched in. |
haystackStart | The start of the region within haystack. Defaults to 0. |
haystackLength | The length of the region within haystack. Defaults to Integer.MAX_VALUE. |
sensitivity | Case sensitivity of the operation. Optional and defaults to Case.Sensitive. |
|
static |
Checks if a given CharSequence is empty or has a length of zero.
cs | The CharSequence to check. |
|
static |
Static method that returns the index of the first character which is included (alternatively not included) in a given set of characters. The search starts at the end of the region and continues towards its start.
haystack | The string to be searched. |
regionStart | The start of the region within haystack. |
regionLength | The length of the region within haystack. |
needles | An array that holds the characters to be searched for. |
inclusion | Denotes whether the search returns the first index that holds a value that is included or that is not excluded in the set of needle characters. |
|
static |
Static utility function to check if a string starts with another string with case insensitive compare. Using this function avoids to create two converted (lowered) temporary strings.
haystack | The CharSequence to search in. |
needle | The CharSequence to search for. |
|
static |
Contains all characters that by default get trimmed by trim methods defined in this class.
|
static |
An empty String singleton
|
static |
The system depended new line character codes retrieved statically (once) using "System.getProperty("line.separator");"
|
static |
A singleton that references a zero-length character array. Used to avoid object allocation.