Package org.eclipse.cdt.core.parser.util
Class CharArrayUtils
java.lang.Object
org.eclipse.cdt.core.parser.util.CharArrayUtils
A static utility class for char arrays
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final char[]static final char[][]static final char[] -
Method Summary
Modifier and TypeMethodDescriptionstatic final intcompare(char[] str1, char[] str2) Implements a lexicographical comparator for char arrays.static final char[]concat(char[] first, char[] second) static final booleanequals(char[][] strarr1, char[][] strarr2) static final booleanequals(char[] str1, char[] str2) static final booleanequals(char[] str1, int start1, int length1, char[] str2) Returnstrueif the contents of a section of a character array are the same as contents of another character array.static final booleanequals(char[] str1, int start1, int length1, char[] str2, boolean ignoreCase) static final booleanReturnstrueif the contents of a section of a character array are the same as contents of a string.static final booleanReturnstrueif the contents of a character array are the same as contents of a string.static final char[]extract(char[] str, int start, int length) static char[]Converts aStringBuilderto a character array.static final inthash(char[] str) static final inthash(char[] str, int start, int length) static final intindexOf(char[] toBeFound, char[] array) static intindexOf(char[] searchFor, char[][] searchIn) Finds an array of chars in an array of arrays of chars.static final intindexOf(char toBeFound, char[] array) static intindexOf(char toBeFound, char[] buffer, int start, int end) static final intlastIndexOf(char[] toBeFound, char[] array) static intlastIndexOf(char[] toBeFound, char[] array, int fromIndex) static intlastIndexOf(char toBeFound, char[] array) static intlastIndexOf(char toBeFound, char[] array, int fromIndex) static final char[]lastSegment(char[] array, char[] separator) static voidoverWrite(char[] buff, int i, char[] charImage) static final char[]replace(char[] array, char[] toBeReplaced, char[] replacementChars) static final booleanstartsWith(char[] str1, String str2) Returnstrueif a prefix of the character array is the same as contents of a string.static final char[][]subarray(char[][] array, int start, int end) static final char[]subarray(char[] array, int start, int end) static final 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
Returnstrueif the contents of a character array are the same as contents of a string.- Since:
- 5.4
-
equals
Returnstrueif the contents of a section of a character array are the same as contents of a string.- Since:
- 5.5
-
startsWith
Returnstrueif 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) Returnstrueif 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) -
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 aStringBuilderto a character array.- Since:
- 5.5
-