Package org.eclipse.cdt.core.parser.util

# Class CharArrayUtils

java.lang.Object
org.eclipse.cdt.core.parser.util.CharArrayUtils

public class CharArrayUtils extends Object
A static utility class for char arrays

## Field Summary

Fields
Modifier and Type
Field
Description
`static final char[]`
`EMPTY`
`static final char[][]`
`EMPTY_ARRAY_OF_CHAR_ARRAYS`
`static final char[]`
`EMPTY_CHAR_ARRAY`

## Method Summary

Modifier and Type
Method
Description
`static final int`
`compare(char[] str1, char[] str2)`
Implements a lexicographical comparator for char arrays.
`static final char[]`
`concat(char[] first, char[] second)`
`static final boolean`
`equals(char[][] strarr1, char[][] strarr2)`
`static final boolean`
`equals(char[] str1, char[] str2)`
`static final boolean`
`equals(char[] str1, int start1, int length1, char[] str2)`
Returns `true` if the contents of a section of a character array are the same as contents of another character array.
`static final boolean`
`equals(char[] str1, int start1, int length1, char[] str2, boolean ignoreCase)`
`static final boolean`
`equals(char[] str1, int start1, int length1, String str2)`
Returns `true` if the contents of a section of a character array are the same as contents of a string.
`static final boolean`
`equals(char[] str1, String str2)`
Returns `true` if 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[]`
`extractChars(StringBuilder buf)`
Converts a `StringBuilder` to a character array.
`static final int`
`hash(char[] str)`
`static final int`
`hash(char[] str, int start, int length)`
`static final 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 final int`
`indexOf(char toBeFound, char[] array)`
`static int`
`indexOf(char toBeFound, char[] buffer, int start, int end)`
`static final 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 final char[]`
`lastSegment(char[] array, char[] separator)`
`static void`
`overWrite(char[] buff, int i, char[] charImage)`
`static final char[]`
`replace(char[] array, char[] toBeReplaced, char[] replacementChars)`
`static final boolean`
`startsWith(char[] str1, String str2)`
Returns `true` if 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)`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## 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

public static final boolean equals(char[] str1, String str2)
Returns `true` if the contents of a character array are the same as contents of a string.

Since:
  5.4

### equals

public static final boolean equals(char[] str1, int start1, int length1, String str2)
Returns `true` if the contents of a section of a character array are the same as contents of a string.

Since:
  5.5

### startsWith

public static final boolean startsWith(char[] str1, String str2)
Returns `true` 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 compare
  `str2` - 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)
Returns `true` 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)

### 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

public static char[] extractChars(StringBuilder buf)
Converts a `StringBuilder` to a character array.

Since:
  5.5