Class CharArrayUtils
java.lang.Object
org.aspectj.org.eclipse.jdt.internal.core.nd.util.CharArrayUtils
A static utility class for char arrays.
-
Field Summary
Modifier and TypeFieldDescriptionstatic char[]
static char[][]
static char[]
-
Method Summary
Modifier and TypeMethodDescriptionstatic int
compare(char[] str1, char[] str2)
Implements a lexicographical comparator for char arrays.static char[]
concat(char[]... toCatenate)
Answers a new array which is the concatenation of all the given arrays.static char[]
concat(char[] first, char[] second)
static char[]
concat(char[] first, char[] second, char[] third)
static char[]
concat(char[] first, char[] second, char[] third, char[] fourth)
static boolean
endsWith(char[] fieldDescriptor, char c)
static boolean
equals(char[][] strarr1, char[][] strarr2)
static boolean
equals(char[] str1, char[] str2)
static boolean
equals(char[] str1, int start1, int length1, char[] str2)
Returnstrue
if the contents of a section of a character array are the same as contents of another character array.static boolean
equals(char[] str1, int start1, int length1, char[] str2, boolean ignoreCase)
static boolean
Returnstrue
if the contents of a section of a character array are the same as contents of a string.static boolean
Returnstrue
if the contents of a character array are the same as contents of a string.static char[]
extract(char[] str, int start, int length)
static char[]
extractChars(StringBuilder buf)
Converts aStringBuilder
to a character array.static boolean
hasCharAt(char toLookFor, int position, char[] toSearch)
Returns true iff the given array contains the given char at the given positionstatic int
hash(char[] str)
static int
hash(char[] str, int start, int length)
static int
indexOf(char[] toBeFound, char[] array)
static int
indexOf(char[] searchFor, char[][] searchIn)
Finds an array of chars in an array of arrays of chars.static int
indexOf(char toBeFound, char[] array)
static int
indexOf(char toBeFound, char[] buffer, int start, int end)
static int
lastIndexOf(char[] toBeFound, char[] array)
static int
lastIndexOf(char[] toBeFound, char[] array, int fromIndex)
static int
lastIndexOf(char toBeFound, char[] array)
static int
lastIndexOf(char toBeFound, char[] array, int fromIndex)
static char[]
lastSegment(char[] array, char[] separator)
static char[]
notNull(char[] contents)
If the given array is null, returns the empty array.static void
overWrite(char[] buff, int i, char[] charImage)
static char[]
replace(char[] array, char[] toBeReplaced, char[] replacementChars)
static boolean
startsWith(char[] fieldDescriptor, char c)
static boolean
startsWith(char[] str1, String str2)
Returnstrue
if a prefix of the character array is the same as contents of a string.static char[][]
subarray(char[][] array, int start, int end)
static char[]
subarray(char[] inputString, int index)
static char[]
subarray(char[] array, int start, int end)
static char[]
trim(char[] chars)
-
Field Details
-
EMPTY_CHAR_ARRAY
public static final char[] EMPTY_CHAR_ARRAY- Since:
- 5.4
-
EMPTY
public static final char[] EMPTY -
EMPTY_ARRAY_OF_CHAR_ARRAYS
public static final char[][] EMPTY_ARRAY_OF_CHAR_ARRAYS- Since:
- 5.7
-
-
Method Details
-
hash
public static final int hash(char[] str, int start, int length) -
hash
public static final int hash(char[] str) -
equals
public static final boolean equals(char[] str1, char[] str2) -
equals
public static final boolean equals(char[][] strarr1, char[][] strarr2) -
equals
Returnstrue
if the contents of a character array are the same as contents of a string.- Since:
- 5.4
-
hasCharAt
public static final boolean hasCharAt(char toLookFor, int position, char[] toSearch)Returns true iff the given array contains the given char at the given position -
equals
Returnstrue
if the contents of a section of a character array are the same as contents of a string.- Since:
- 5.5
-
startsWith
Returnstrue
if a prefix of the character array is the same as contents of a string.- Since:
- 5.4
-
compare
public static final int compare(char[] str1, char[] str2)Implements a lexicographical comparator for char arrays. Comparison is done on a per char basis, not a code-point basis.- Parameters:
str1
- the first of the two char arrays to comparestr2
- the second of the two char arrays to compare- Returns:
- 0 if str1==str2, -1 if str1 < str2 and 1 if str1 > str2
-
equals
public static final boolean equals(char[] str1, int start1, int length1, char[] str2)Returnstrue
if the contents of a section of a character array are the same as contents of another character array. -
equals
public static final boolean equals(char[] str1, int start1, int length1, char[] str2, boolean ignoreCase) -
extract
public static final char[] extract(char[] str, int start, int length) -
concat
public static final char[] concat(char[] first, char[] second) -
concat
public static final char[] concat(char[] first, char[] second, char[] third) -
concat
public static final char[] concat(char[] first, char[] second, char[] third, char[] fourth) -
concat
public static char[] concat(char[]... toCatenate)Answers a new array which is the concatenation of all the given arrays.- Parameters:
toCatenate
-- Since:
- 3.12
-
replace
public static final char[] replace(char[] array, char[] toBeReplaced, char[] replacementChars) -
subarray
public static final char[][] subarray(char[][] array, int start, int end) -
subarray
public static final char[] subarray(char[] array, int start, int end) -
indexOf
public static final int indexOf(char toBeFound, char[] array) -
indexOf
public static int indexOf(char toBeFound, char[] buffer, int start, int end) -
indexOf
public static final int indexOf(char[] toBeFound, char[] array) -
lastIndexOf
public static final int lastIndexOf(char[] toBeFound, char[] array) -
lastIndexOf
public static int lastIndexOf(char toBeFound, char[] array)- Since:
- 5.11
-
lastIndexOf
public static int lastIndexOf(char toBeFound, char[] array, int fromIndex)- Since:
- 5.11
-
lastIndexOf
public static int lastIndexOf(char[] toBeFound, char[] array, int fromIndex)- Since:
- 5.11
-
trim
public static final char[] trim(char[] chars) -
lastSegment
public static final char[] lastSegment(char[] array, char[] separator) -
overWrite
public static void overWrite(char[] buff, int i, char[] charImage)- Parameters:
buff
-i
-charImage
-
-
indexOf
public static int indexOf(char[] searchFor, char[][] searchIn)Finds an array of chars in an array of arrays of chars.- Returns:
- offset where the array was found or
-1
-
extractChars
Converts aStringBuilder
to a character array.- Since:
- 5.5
-
subarray
public static char[] subarray(char[] inputString, int index) -
startsWith
public static boolean startsWith(char[] fieldDescriptor, char c) -
notNull
public static char[] notNull(char[] contents)If the given array is null, returns the empty array. Otherwise, returns the argument. -
endsWith
public static boolean endsWith(char[] fieldDescriptor, char c)
-