Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Eclipse JDT Release 3.0
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.eclipse.jdt.core.compiler
Class CharOperation

    java.lang.Object
      org.eclipse.jdt.core.compiler.CharOperation

public final class CharOperation
extends Object

This class is a collection of helper methods to manipulate char arrays.

Since:
  2.1

Field Summary
`static char[]` | `NO_CHAR` Constant for an empty char array
`static char[][]` | `NO_CHAR_CHAR` Constant for an empty char array with two dimensions.

Constructor Summary
`CharOperation()`

Method Summary
`static char[]` | `append(char[] array, char suffix)` Answers a new array with appending the suffix character at the end of the array.
`static char[]` | `append(char[] target, int index, char[] array, int start, int end)` Append the given subarray to the target array starting at the given index in the target array.
`static char[][]` | `arrayConcat(char[][] first, char[] second)` Answers a new array adding the second array at the end of first array.
`static char[][]` | `arrayConcat(char[][] first, char[][] second)` Answers the concatenation of the two arrays.
`static String[]` | `charArrayToStringArray(char[][] charArrays)` Returns the char arrays as an array of Strings
`static String` | `charToString(char[] charArray)` Returns the char array as a String
`static int` | `compareWith(char[] array, char[] prefix)` Compares the contents of the two arrays array and prefix.
`static char[]` | `concat(char[] first, char[] second)` Answers the concatenation of the two arrays.
`static char[]` | `concat(char[] first, char[] second, char separator)` Answers the concatenation of the two arrays inserting the separator character between the two arrays.
`static char[]` | `concat(char[] first, char[] second, char[] third)` Answers the concatenation of the three arrays.
`static char[]` | `concat(char[] first, char sep1, char[] second, char sep2, char[] third)` Answers the concatenation of the three arrays inserting the sep1 character between the two arrays and sep2 between the last two.
`static char[]` | `concat(char prefix, char[] array, char suffix)` Answers a new array with prepending the prefix character and appending the suffix character at the end of the array.
`static char[]` | `concatWith(char[][] array, char separator)` Answers the concatenation of the given array parts using the given separator between each part.
`static char[]` | `concatWith(char[][] array, char[] name, char separator)` Answers the concatenation of the given array parts using the given separator between each part and appending the given name at the end.
`static char[]` | `concatWith(char[] name, char[][] array, char separator)` Answers the concatenation of the given array parts using the given separator between each part and appending the given name at the end.
`static boolean` | `contains(char character, char[] array)` Answers true if the array contains an occurrence of character, false otherwise.
`static boolean` | `contains(char character, char[][] array)` Answers true if the array contains an occurrence of character, false otherwise.
`static char[][]` | `deepCopy(char[][] toCopy)` Answers a deep copy of the toCopy array.
`static boolean` | `endsWith(char[] array, char[] toBeFound)` Return true if array ends with the sequence of characters contained in toBeFound, otherwise false.
`static boolean` | `equals(char[][] first, char[][] second)` Answers true if the two arrays are identical character by character, otherwise false.
`static boolean` | `equals(char[][] first, char[][] second, boolean isCaseSensitive)` If isCaseSensite is true, answers true if the two arrays are identical character by character, otherwise false.
`static boolean` | `equals(char[] first, char[] second)` Answers true if the two arrays are identical character by character, otherwise false.
`static boolean` | `equals(char[] first, char[] second, boolean isCaseSensitive)` If isCaseSensite is true, answers true if the two arrays are identical character by character, otherwise false.
`static boolean` | `equals(char[] first, char[] second, int secondStart, int secondEnd)` Answers true if the first array is identical character by character to a portion of the second array delimited from position secondStart (inclusive) to secondEnd(exclusive), otherwise false.
`static boolean` | `fragmentEquals(char[] fragment, char[] name, int startIndex, boolean isCaseSensitive)` If isCaseSensite is true, the equality is case sensitive, otherwise it is case insensitive.
`static int` | `hashCode(char[] array)` Answers a hashcode for the array
`static int` | `indexOf(char toBeFound, char[] array)` Answers the first index in the array for which the corresponding character is equal to toBeFound.
`static int` | `indexOf(char toBeFound, char[] array, int start)` Answers the first index in the array for which the corresponding character is equal to toBeFound starting the search at index start.
`static boolean` | `isWhitespace(char c)` Answers true if c is a whitespace according to the JLS (\u000a, \u000c, \u000d, \u0009), otherwise false.
`static int` | `lastIndexOf(char toBeFound, char[] array)` Answers the last index in the array for which the corresponding character is equal to toBeFound starting from the end of the array.
`static int` | `lastIndexOf(char toBeFound, char[] array, int startIndex)` Answers the last index in the array for which the corresponding character is equal to toBeFound stopping at the index startIndex.
`static int` | `lastIndexOf(char toBeFound, char[] array, int startIndex, int endIndex)` Answers the last index in the array for which the corresponding character is equal to toBeFound starting from endIndex to startIndex.
`static char[]` | `lastSegment(char[] array, char separator)` Answers the last portion of a name given a separator.
`static boolean` | `match(char[] pattern, char[] name, boolean isCaseSensitive)` Answers true if the pattern matches the given name, false otherwise.
`static boolean` | `match(char[] pattern, int patternStart, int patternEnd, char[] name, int nameStart, int nameEnd, boolean isCaseSensitive)` Answers true if the a sub-pattern matches the subpart of the given name, false otherwise.
`static int` | `occurencesOf(char toBeFound, char[] array)` Answers the number of occurrences of the given character in the given array, 0 if any.
`static int` | `occurencesOf(char toBeFound, char[] array, int start)` Answers the number of occurrences of the given character in the given array starting at the given index, 0 if any.
`static boolean` | `pathMatch(char[] pattern, char[] filepath, boolean isCaseSensitive, char pathSeparator)` Answers true if the pattern matches the filepath using the pathSepatator, false otherwise.
`static boolean` | `prefixEquals(char[] prefix, char[] name)` Answers true if the given name starts with the given prefix, false otherwise.
`static boolean` | `prefixEquals(char[] prefix, char[] name, boolean isCaseSensitive)` Answers true if the given name starts with the given prefix, false otherwise.
`static char[]` | `replace(char[] array, char[] toBeReplaced, char[] replacementChars)` Answers a new array of characters with substitutions.
`static void` | `replace(char[] array, char toBeReplaced, char replacementChar)` Replace all occurrence of the character to be replaced with the remplacement character in the given array.
`static char[][]` | `splitAndTrimOn(char divider, char[] array)` Return a new array which is the split of the given array using the given divider and triming each subarray to remove whitespaces equals to ' '.
`static char[][]` | `splitOn(char divider, char[] array)` Return a new array which is the split of the given array using the given divider.
`static char[][]` | `splitOn(char divider, char[] array, int start, int end)` Return a new array which is the split of the given array using the given divider.
`static char[][]` | `subarray(char[][] array, int start, int end)` Answers a new array which is a copy of the given array starting at the given start and ending at the given end.
`static char[]` | `subarray(char[] array, int start, int end)` Answers a new array which is a copy of the given array starting at the given start and ending at the given end.
`static char[]` | `toLowerCase(char[] chars)` Answers the result of a char[] conversion to lowercase.
`static String` | `toString(char[][] array)` Answers a string which is the concatenation of the given array using the '.' as a separator.
`static String[]` | `toStrings(char[][] array)` Answers an array of strings from the given array of char array.
`static char[]` | `trim(char[] chars)` Answers a new array removing leading and trailing spaces (' ').

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### NO_CHAR

    public static final char[] NO_CHAR

  Constant for an empty char array

### NO_CHAR_CHAR

    public static final char[][] NO_CHAR_CHAR

  Constant for an empty char array with two dimensions.

Constructor Detail

### CharOperation

    public CharOperation()

Method Detail

### append

    public static final char[] append(char[] array,
                                      char suffix)

  Answers a new array with appending the suffix character at the end of the array.
  For example:

  1.         array = { 'a', 'b' }
             suffix = 'c'
             => result = { 'a', 'b' , 'c' }

  2.         array = null
             suffix = 'c'
             => result = { 'c' }

  Parameters:
    `array` - the array that is concanated with the suffix character
    `suffix` - the suffix character
  Returns:
    the new array

### append

    public static final char[] append(char[] target,
                                      int index,
                                      char[] array,
                                      int start,
                                      int end)

  Append the given subarray to the target array starting at the given index in the target array. The start of the subarray is inclusive, the end is exclusive. Answers a new target array if it needs to grow, otherwise answers the same target array.
  For example:

  1.         target = { 'a', 'b', '0' }
             index = 2
             array = { 'c', 'd' }
             start = 0
             end = 1
             => result = { 'a', 'b' , 'c' }

  2.         target = { 'a', 'b' }
             index = 2
             array = { 'c', 'd' }
             start = 0
             end = 1
             => result = { 'a', 'b' , 'c', '0', '0' , '0' } (new array)

  3.         target = { 'a', 'b', 'c' }
             index = 1
             array = { 'c', 'd', 'e', 'f' }
             start = 1
             end = 4
             => result = { 'a', 'd' , 'e', 'f', '0', '0', '0', '0' } (new array)

  Parameters:
    `target` - the given target
    `index` - the given index
    `array` - the given array
    `start` - the given start index
    `end` - the given end index
  Returns:
    the new array
  Throws:
    `NullPointerException` - if the target array is null

### arrayConcat

    public static final char[][] arrayConcat(char[][] first,
                                             char[][] second)

  Answers the concatenation of the two arrays. It answers null if the two arrays are null. If the first array is null, then the second array is returned. If the second array is null, then the first array is returned.
  For example:

  1.         first = null
             second = null
             => result = null

  2.         first = { { ' a' } }
             second = null
             => result = { { ' a' } }

  3.         first = null
             second = { { ' a' } }
             => result = { { ' a' } }

  4.         first = { { ' b' } }
             second = { { ' a' } }
             => result = { { ' b' }, { ' a' } }

  Parameters:
    `first` - the first array to concatenate
    `second` - the second array to concatenate
  Returns:
    the concatenation of the two arrays, or null if the two arrays are null.

### charArrayToStringArray

    public static String[] charArrayToStringArray(char[][] charArrays)

  Returns the char arrays as an array of Strings

  Parameters:
    `charArrays` - the char array to convert
  Returns:
    the char arrays as an array of Strings or null if the given char arrays is null.
  Since:
    3.0

### charToString

    public static String charToString(char[] charArray)

  Returns the char array as a String

  Parameters:
    `charArray` - the char array to convert
  Returns:
    the char array as a String or null if the given char array is null.
  Since:
    3.0

### arrayConcat

    public static final char[][] arrayConcat(char[][] first,
                                             char[] second)

  Answers a new array adding the second array at the end of first array. It answers null if the first and second are null. If the first array is null, then a new array char[][] is created with second. If the second array is null, then the first array is returned.
  For example:

  1.         first = null
             second = { 'a' }
             => result = { { ' a' } }

  2.         first = { { ' a' } }
             second = null
             => result = { { ' a' } }

  3.         first = { { ' a' } }
             second = { ' b' }
             => result = { { ' a' } , { ' b' } }

  Parameters:
    `first` - the first array to concatenate
    `second` - the array to add at the end of the first array
  Returns:
    a new array adding the second array at the end of first array, or null if the two arrays are null.

### compareWith

    public static final int compareWith(char[] array,
                                        char[] prefix)

  Compares the contents of the two arrays array and prefix. Returns
  - zero if the array starts with the prefix contents
  - the difference between the first two characters that are not equal
  - one if array length is lower than the prefix length and that the prefix starts with the array contents.

  For example:

  1.         array = null
             prefix = null
             => result = NullPointerException

  2.         array = { 'a', 'b', 'c', 'd', 'e' }
             prefix = { 'a', 'b', 'c'}
             => result = 0

  3.         array = { 'a', 'b', 'c', 'd', 'e' }
             prefix = { 'a', 'B', 'c'}
             => result = 32

  4.         array = { 'd', 'b', 'c', 'd', 'e' }
             prefix = { 'a', 'b', 'c'}
             => result = 3

  5.         array = { 'a', 'b', 'c', 'd', 'e' }
             prefix = { 'd', 'b', 'c'}
             => result = -3

  6.         array = { 'a', 'a', 'c', 'd', 'e' }
             prefix = { 'a', 'e', 'c'}
             => result = -4

  Parameters:
    `array` - the given array
    `prefix` - the given prefix
  Returns:
    the result of the comparison (>=0 if array>prefix)
  Throws:
    `NullPointerException` - if either array or prefix is null

### concat

    public static final char[] concat(char[] first,
                                      char[] second)

  Answers the concatenation of the two arrays. It answers null if the two arrays are null. If the first array is null, then the second array is returned. If the second array is null, then the first array is returned.
  For example:

  1.         first = null
             second = { 'a' }
             => result = { ' a' }

  2.         first = { ' a' }
             second = null
             => result = { ' a' }

  3.         first = { ' a' }
             second = { ' b' }
             => result = { ' a' , ' b' }

  Parameters:
    `first` - the first array to concatenate
    `second` - the second array to concatenate
  Returns:
    the concatenation of the two arrays, or null if the two arrays are null.

### concat

    public static final char[] concat(char[] first,
                                      char[] second,
                                      char[] third)

  Answers the concatenation of the three arrays. It answers null if the three arrays are null. If first is null, it answers the concatenation of second and third. If second is null, it answers the concatenation of first and third. If third is null, it answers the concatenation of first and second.
  For example:

  1.         first = null
             second = { 'a' }
             third = { 'b' }
             => result = { ' a', 'b' }

  2.         first = { 'a' }
             second = null
             third = { 'b' }
             => result = { ' a', 'b' }

  3.         first = { 'a' }
             second = { 'b' }
             third = null
             => result = { ' a', 'b' }

  4.         first = null
             second = null
             third = null
             => result = null

  5.         first = { 'a' }
             second = { 'b' }
             third = { 'c' }
             => result = { 'a', 'b', 'c' }

  Parameters:
    `first` - the first array to concatenate
    `second` - the second array to concatenate
    `third` - the third array to concatenate
  Returns:
    the concatenation of the three arrays, or null if the three arrays are null.

### concat

    public static final char[] concat(char[] first,
                                      char[] second,
                                      char separator)

  Answers the concatenation of the two arrays inserting the separator character between the two arrays. It answers null if the two arrays are null. If the first array is null, then the second array is returned. If the second array is null, then the first array is returned.
  For example:

  1.         first = null
             second = { 'a' }
             separator = '/'
             => result = { ' a' }

  2.         first = { ' a' }
             second = null
             separator = '/'
             => result = { ' a' }

  3.         first = { ' a' }
             second = { ' b' }
             separator = '/'
             => result = { ' a' , '/', 'b' }

  Parameters:
    `first` - the first array to concatenate
    `second` - the second array to concatenate
    `separator` - the character to insert
  Returns:
    the concatenation of the two arrays inserting the separator character between the two arrays , or null if the two arrays are null.

### concat

    public static final char[] concat(char[] first,
                                      char sep1,
                                      char[] second,
                                      char sep2,
                                      char[] third)

  Answers the concatenation of the three arrays inserting the sep1 character between the two arrays and sep2 between the last two. It answers null if the three arrays are null. If the first array is null, then it answers the concatenation of second and third inserting the sep2 character between them. If the second array is null, then it answers the concatenation of first and third inserting the sep1 character between them. If the third array is null, then it answers the concatenation of first and second inserting the sep1 character between them.
  For example:

  1.         first = null
             sep1 = '/'
             second = { 'a' }
             sep2 = ':'
             third = { 'b' }
             => result = { ' a' , ':', 'b' }

  2.         first = { 'a' }
             sep1 = '/'
             second = null
             sep2 = ':'
             third = { 'b' }
             => result = { ' a' , '/', 'b' }

  3.         first = { 'a' }
             sep1 = '/'
             second = { 'b' }
             sep2 = ':'
             third = null
             => result = { ' a' , '/', 'b' }

  4.         first = { 'a' }
             sep1 = '/'
             second = { 'b' }
             sep2 = ':'
             third = { 'c' }
             => result = { ' a' , '/', 'b' , ':', 'c' }

  Parameters:
    `first` - the first array to concatenate
    `sep1` - the character to insert
    `second` - the second array to concatenate
    `sep2` - the character to insert
    `third` - the second array to concatenate
  Returns:
    the concatenation of the three arrays inserting the sep1 character between the two arrays and sep2 between the last two.

### concat

    public static final char[] concat(char prefix,
                                      char[] array,
                                      char suffix)

  Answers a new array with prepending the prefix character and appending the suffix character at the end of the array. If array is null, it answers a new array containing the prefix and the suffix characters.
  For example:

  1.         prefix = 'a'
             array = { 'b' }
             suffix = 'c'
             => result = { 'a', 'b' , 'c' }

  2.         prefix = 'a'
             array = null
             suffix = 'c'
             => result = { 'a', 'c' }

  Parameters:
    `prefix` - the prefix character
    `array` - the array that is concanated with the prefix and suffix characters
    `suffix` - the suffix character
  Returns:
    the new array

### concatWith

    public static final char[] concatWith(char[] name,
                                          char[][] array,
                                          char separator)

  Answers the concatenation of the given array parts using the given separator between each part and appending the given name at the end.
  For example:

  1.         name = { 'c' }
             array = { { 'a' }, { 'b' } }
             separator = '.'
             => result = { 'a', '.', 'b' , '.', 'c' }

  2.         name = null
             array = { { 'a' }, { 'b' } }
             separator = '.'
             => result = { 'a', '.', 'b' }

  3.         name = { ' c' }
             array = null
             separator = '.'
             => result = { 'c' }

  Parameters:
    `name` - the given name
    `array` - the given array
    `separator` - the given separator
  Returns:
    the concatenation of the given array parts using the given separator between each part and appending the given name at the end

### concatWith

    public static final char[] concatWith(char[][] array,
                                          char[] name,
                                          char separator)

  Answers the concatenation of the given array parts using the given separator between each part and appending the given name at the end.
  For example:

  1.         name = { 'c' }
             array = { { 'a' }, { 'b' } }
             separator = '.'
             => result = { 'a', '.', 'b' , '.', 'c' }

  2.         name = null
             array = { { 'a' }, { 'b' } }
             separator = '.'
             => result = { 'a', '.', 'b' }

  3.         name = { ' c' }
             array = null
             separator = '.'
             => result = { 'c' }

  Parameters:
    `array` - the given array
    `name` - the given name
    `separator` - the given separator
  Returns:
    the concatenation of the given array parts using the given separator between each part and appending the given name at the end

### concatWith

    public static final char[] concatWith(char[][] array,
                                          char separator)

  Answers the concatenation of the given array parts using the given separator between each part.
  For example:

  1.         array = { { 'a' }, { 'b' } }
             separator = '.'
             => result = { 'a', '.', 'b' }

  2.         array = null
             separator = '.'
             => result = { }

  Parameters:
    `array` - the given array
    `separator` - the given separator
  Returns:
    the concatenation of the given array parts using the given separator between each part

### contains

    public static final boolean contains(char character,
                                         char[][] array)

  Answers true if the array contains an occurrence of character, false otherwise.
  For example:

  1.         character = 'c'
             array = { { ' a' }, { ' b' } }
             result => false

  2.         character = 'a'
             array = { { ' a' }, { ' b' } }
             result => true

  Parameters:
    `character` - the character to search
    `array` - the array in which the search is done
  Returns:
    true if the array contains an occurrence of character, false otherwise.
  Throws:
    `NullPointerException` - if array is null.

### contains

    public static final boolean contains(char character,
                                         char[] array)

  Answers true if the array contains an occurrence of character, false otherwise.
  For example:

  1.         character = 'c'
             array = { ' b'  }
             result => false

  2.         character = 'a'
             array = { ' a' , ' b' }
             result => true

  Parameters:
    `character` - the character to search
    `array` - the array in which the search is done
  Returns:
    true if the array contains an occurrence of character, false otherwise.
  Throws:
    `NullPointerException` - if array is null.

### deepCopy

    public static final char[][] deepCopy(char[][] toCopy)

  Answers a deep copy of the toCopy array.

  Parameters:
    `toCopy` - the array to copy
  Returns:
    a deep copy of the toCopy array.

### endsWith

    public static final boolean endsWith(char[] array,
                                         char[] toBeFound)

  Return true if array ends with the sequence of characters contained in toBeFound, otherwise false.
  For example:

  1.         array = { 'a', 'b', 'c', 'd' }
             toBeFound = { 'b', 'c' }
             result => false

  2.         array = { 'a', 'b', 'c' }
             toBeFound = { 'b', 'c' }
             result => true

  Parameters:
    `array` - the array to check
    `toBeFound` - the array to find
  Returns:
    true if array ends with the sequence of characters contained in toBeFound, otherwise false.
  Throws:
    `NullPointerException` - if array is null or toBeFound is null

### equals

    public static final boolean equals(char[][] first,
                                       char[][] second)

  Answers true if the two arrays are identical character by character, otherwise false. The equality is case sensitive.
  For example:

  1.         first = null
             second = null
             result => true

  2.         first = { { } }
             second = null
             result => false

  3.         first = { { 'a' } }
             second = { { 'a' } }
             result => true

  4.         first = { { 'A' } }
             second = { { 'a' } }
             result => false

  Parameters:
    `first` - the first array
    `second` - the second array
  Returns:
    true if the two arrays are identical character by character, otherwise false

### equals

    public static final boolean equals(char[][] first,
                                       char[][] second,
                                       boolean isCaseSensitive)

  If isCaseSensite is true, answers true if the two arrays are identical character by character, otherwise false. If it is false, answers true if the two arrays are identical character by character without checking the case, otherwise false.
  For example:

  1.         first = null
             second = null
             isCaseSensitive = true
             result => true

  2.         first = { { } }
             second = null
             isCaseSensitive = true
             result => false

  3.         first = { { 'A' } }
             second = { { 'a' } }
             isCaseSensitive = true
             result => false

  4.         first = { { 'A' } }
             second = { { 'a' } }
             isCaseSensitive = false
             result => true

  Parameters:
    `first` - the first array
    `second` - the second array
    `isCaseSensitive` - check whether or not the equality should be case sensitive
  Returns:
    true if the two arrays are identical character by character according to the value of isCaseSensitive, otherwise false

### equals

    public static final boolean equals(char[] first,
                                       char[] second)

  Answers true if the two arrays are identical character by character, otherwise false. The equality is case sensitive.
  For example:

  1.         first = null
             second = null
             result => true

  2.         first = { }
             second = null
             result => false

  3.         first = { 'a' }
             second = { 'a' }
             result => true

  4.         first = { 'a' }
             second = { 'A' }
             result => false

  Parameters:
    `first` - the first array
    `second` - the second array
  Returns:
    true if the two arrays are identical character by character, otherwise false

### equals

    public static final boolean equals(char[] first,
                                       char[] second,
                                       int secondStart,
                                       int secondEnd)

  Answers true if the first array is identical character by character to a portion of the second array delimited from position secondStart (inclusive) to secondEnd(exclusive), otherwise false. The equality is case sensitive.
  For example:

  1.         first = null
             second = null
             secondStart = 0
             secondEnd = 0
             result => true

  2.         first = { }
             second = null
             secondStart = 0
             secondEnd = 0
             result => false

  3.         first = { 'a' }
             second = { 'a' }
             secondStart = 0
             secondEnd = 1
             result => true

  4.         first = { 'a' }
             second = { 'A' }
             secondStart = 0
             secondEnd = 1
             result => false

  Parameters:
    `first` - the first array
    `second` - the second array
    `secondStart` - inclusive start position in the second array to compare
    `secondEnd` - exclusive end position in the second array to compare
  Returns:
    true if the first array is identical character by character to fragment of second array ranging from secondStart to secondEnd-1, otherwise false
  Since:
    3.0

### equals

    public static final boolean equals(char[] first,
                                       char[] second,
                                       boolean isCaseSensitive)

  If isCaseSensite is true, answers true if the two arrays are identical character by character, otherwise false. If it is false, answers true if the two arrays are identical character by character without checking the case, otherwise false.
  For example:

  1.         first = null
             second = null
             isCaseSensitive = true
             result => true

  2.         first = { }
             second = null
             isCaseSensitive = true
             result => false

  3.         first = { 'A' }
             second = { 'a' }
             isCaseSensitive = true
             result => false

  4.         first = { 'A' }
             second = { 'a' }
             isCaseSensitive = false
             result => true

  Parameters:
    `first` - the first array
    `second` - the second array
    `isCaseSensitive` - check whether or not the equality should be case sensitive
  Returns:
    true if the two arrays are identical character by character according to the value of isCaseSensitive, otherwise false

### fragmentEquals

    public static final boolean fragmentEquals(char[] fragment,
                                               char[] name,
                                               int startIndex,
                                               boolean isCaseSensitive)

  If isCaseSensite is true, the equality is case sensitive, otherwise it is case insensitive. Answers true if the name contains the fragment at the starting index startIndex, otherwise false.
  For example:

  1.         fragment = { 'b', 'c' , 'd' }
             name = { 'a', 'b', 'c' , 'd' }
             startIndex = 1
             isCaseSensitive = true
             result => true

  2.         fragment = { 'b', 'c' , 'd' }
             name = { 'a', 'b', 'C' , 'd' }
             startIndex = 1
             isCaseSensitive = true
             result => false

  3.         fragment = { 'b', 'c' , 'd' }
             name = { 'a', 'b', 'C' , 'd' }
             startIndex = 0
             isCaseSensitive = false
             result => false

  4.         fragment = { 'b', 'c' , 'd' }
             name = { 'a', 'b'}
             startIndex = 0
             isCaseSensitive = true
             result => false

  Parameters:
    `fragment` - the fragment to check
    `name` - the array to check
    `startIndex` - the starting index
    `isCaseSensitive` - check whether or not the equality should be case sensitive
  Returns:
    true if the name contains the fragment at the starting index startIndex according to the value of isCaseSensitive, otherwise false.
  Throws:
    `NullPointerException` - if fragment or name is null.

### hashCode

    public static final int hashCode(char[] array)

  Answers a hashcode for the array

  Parameters:
    `array` - the array for which a hashcode is required
  Returns:
    the hashcode
  Throws:
    `NullPointerException` - if array is null

### isWhitespace

    public static boolean isWhitespace(char c)

  Answers true if c is a whitespace according to the JLS (\u000a, \u000c, \u000d, \u0009), otherwise false.
  For example:

  1.         c = ' '
             result => true

  2.         c = '\u3000'
             result => false

  Parameters:
    `c` - the character to check
  Returns:
    true if c is a whitespace according to the JLS, otherwise false.

### indexOf

    public static final int indexOf(char toBeFound,
                                    char[] array)

  Answers the first index in the array for which the corresponding character is equal to toBeFound. Answers -1 if no occurrence of this character is found.
  For example:

  1.         toBeFound = 'c'
             array = { ' a', 'b', 'c', 'd' }
             result => 2

  2.         toBeFound = 'e'
             array = { ' a', 'b', 'c', 'd' }
             result => -1

  Parameters:
    `toBeFound` - the character to search
    `array` - the array to be searched
  Returns:
    the first index in the array for which the corresponding character is equal to toBeFound, -1 otherwise
  Throws:
    `NullPointerException` - if array is null

### indexOf

    public static final int indexOf(char toBeFound,
                                    char[] array,
                                    int start)

  Answers the first index in the array for which the corresponding character is equal to toBeFound starting the search at index start. Answers -1 if no occurrence of this character is found.
  For example:

  1.         toBeFound = 'c'
             array = { ' a', 'b', 'c', 'd' }
             start = 2
             result => 2

  2.         toBeFound = 'c'
             array = { ' a', 'b', 'c', 'd' }
             start = 3
             result => -1

  3.         toBeFound = 'e'
             array = { ' a', 'b', 'c', 'd' }
             start = 1
             result => -1

  Parameters:
    `toBeFound` - the character to search
    `array` - the array to be searched
    `start` - the starting index
  Returns:
    the first index in the array for which the corresponding character is equal to toBeFound, -1 otherwise
  Throws:
    `NullPointerException` - if array is null
    `ArrayIndexOutOfBoundsException` - if start is lower than 0

### lastIndexOf

    public static final int lastIndexOf(char toBeFound,
                                        char[] array)

  Answers the last index in the array for which the corresponding character is equal to toBeFound starting from the end of the array. Answers -1 if no occurrence of this character is found.
  For example:

  1.         toBeFound = 'c'
             array = { ' a', 'b', 'c', 'd' , 'c', 'e' }
             result => 4

  2.         toBeFound = 'e'
             array = { ' a', 'b', 'c', 'd' }
             result => -1

  Parameters:
    `toBeFound` - the character to search
    `array` - the array to be searched
  Returns:
    the last index in the array for which the corresponding character is equal to toBeFound starting from the end of the array, -1 otherwise
  Throws:
    `NullPointerException` - if array is null

### lastIndexOf

    public static final int lastIndexOf(char toBeFound,
                                        char[] array,
                                        int startIndex)

  Answers the last index in the array for which the corresponding character is equal to toBeFound stopping at the index startIndex. Answers -1 if no occurrence of this character is found.
  For example:

  1.         toBeFound = 'c'
             array = { ' a', 'b', 'c', 'd' }
             startIndex = 2
             result => 2

  2.         toBeFound = 'c'
             array = { ' a', 'b', 'c', 'd', 'e' }
             startIndex = 3
             result => -1

  3.         toBeFound = 'e'
             array = { ' a', 'b', 'c', 'd' }
             startIndex = 0
             result => -1

  Parameters:
    `toBeFound` - the character to search
    `array` - the array to be searched
    `startIndex` - the stopping index
  Returns:
    the last index in the array for which the corresponding character is equal to toBeFound stopping at the index startIndex, -1 otherwise
  Throws:
    `NullPointerException` - if array is null
    `ArrayIndexOutOfBoundsException` - if startIndex is lower than 0

### lastIndexOf

    public static final int lastIndexOf(char toBeFound,
                                        char[] array,
                                        int startIndex,
                                        int endIndex)

  Answers the last index in the array for which the corresponding character is equal to toBeFound starting from endIndex to startIndex. Answers -1 if no occurrence of this character is found.
  For example:

  1.         toBeFound = 'c'
             array = { ' a', 'b', 'c', 'd' }
             startIndex = 2
             endIndex = 2
             result => 2

  2.         toBeFound = 'c'
             array = { ' a', 'b', 'c', 'd', 'e' }
             startIndex = 3
             endIndex = 4
             result => -1

  3.         toBeFound = 'e'
             array = { ' a', 'b', 'c', 'd' }
             startIndex = 0
             endIndex = 3
             result => -1

  Parameters:
    `toBeFound` - the character to search
    `array` - the array to be searched
    `startIndex` - the stopping index
    `endIndex` - the starting index
  Returns:
    the last index in the array for which the corresponding character is equal to toBeFound starting from endIndex to startIndex, -1 otherwise
  Throws:
    `NullPointerException` - if array is null
    `ArrayIndexOutOfBoundsException` - if endIndex is greater or equals to array length or starting is lower than 0

### lastSegment

    public static final char[] lastSegment(char[] array,
                                           char separator)

  Answers the last portion of a name given a separator.
  For example,

       	lastSegment("java.lang.Object".toCharArray(),'.') --> Object

  Parameters:
    `array` - the array
    `separator` - the given separator
  Returns:
    the last portion of a name given a separator
  Throws:
    `NullPointerException` - if array is null

### match

    public static final boolean match(char[] pattern,
                                      char[] name,
                                      boolean isCaseSensitive)

  Answers true if the pattern matches the given name, false otherwise. This char[] pattern matching accepts wild-cards '*' and '?'. When not case sensitive, the pattern is assumed to already be lowercased, the name will be lowercased character per character as comparing. If name is null, the answer is false. If pattern is null, the answer is true if name is not null.
  For example:

  1.         pattern = { '?', 'b', '*' }
             name = { 'a', 'b', 'c' , 'd' }
             isCaseSensitive = true
             result => true

  2.         pattern = { '?', 'b', '?' }
             name = { 'a', 'b', 'c' , 'd' }
             isCaseSensitive = true
             result => false

  3.         pattern = { 'b', '*' }
             name = { 'a', 'b', 'c' , 'd' }
             isCaseSensitive = true
             result => false

  Parameters:
    `pattern` - the given pattern
    `name` - the given name
    `isCaseSensitive` - flag to know whether or not the matching should be case sensitive
  Returns:
    true if the pattern matches the given name, false otherwise

### match

    public static final boolean match(char[] pattern,
                                      int patternStart,
                                      int patternEnd,
                                      char[] name,
                                      int nameStart,
                                      int nameEnd,
                                      boolean isCaseSensitive)

  Answers true if the a sub-pattern matches the subpart of the given name, false otherwise. char[] pattern matching, accepting wild-cards '*' and '?'. Can match only subset of name/pattern. end positions are non-inclusive. The subpattern is defined by the patternStart and pattternEnd positions. When not case sensitive, the pattern is assumed to already be lowercased, the name will be lowercased character per character as comparing.
  For example:

  1.         pattern = { '?', 'b', '*' }
             patternStart = 1
             patternEnd = 3
             name = { 'a', 'b', 'c' , 'd' }
             nameStart = 1
             nameEnd = 4
             isCaseSensitive = true
             result => true

  2.         pattern = { '?', 'b', '*' }
             patternStart = 1
             patternEnd = 2
             name = { 'a', 'b', 'c' , 'd' }
             nameStart = 1
             nameEnd = 2
             isCaseSensitive = true
             result => false

  Parameters:
    `pattern` - the given pattern
    `patternStart` - the given pattern start
    `patternEnd` - the given pattern end
    `name` - the given name
    `nameStart` - the given name start
    `nameEnd` - the given name end
    `isCaseSensitive` - flag to know if the matching should be case sensitive
  Returns:
    true if the a sub-pattern matches the subpart of the given name, false otherwise

### pathMatch

    public static final boolean pathMatch(char[] pattern,
                                          char[] filepath,
                                          boolean isCaseSensitive,
                                          char pathSeparator)

  Answers true if the pattern matches the filepath using the pathSepatator, false otherwise. Path char[] pattern matching, accepting wild-cards '**', '*' and '?' (using Ant directory tasks conventions, also see "http://jakarta.apache.org/ant/manual/dirtasks.html#defaultexcludes"). Path pattern matching is enhancing regular pattern matching in supporting extra rule where '**' represent any folder combination. Special rule: - foo\ is equivalent to foo\** When not case sensitive, the pattern is assumed to already be lowercased, the name will be lowercased character per character as comparing.

  Parameters:
    `pattern` - the given pattern
    `filepath` - the given path
    `isCaseSensitive` - to find out whether or not the matching should be case sensitive
    `pathSeparator` - the given path separator
  Returns:
    true if the pattern matches the filepath using the pathSepatator, false otherwise

### occurencesOf

    public static final int occurencesOf(char toBeFound,
                                         char[] array)

  Answers the number of occurrences of the given character in the given array, 0 if any.
  For example:

  1.         toBeFound = 'b'
             array = { 'a' , 'b', 'b', 'a', 'b', 'a' }
             result => 3

  2.         toBeFound = 'c'
             array = { 'a' , 'b', 'b', 'a', 'b', 'a' }
             result => 0

  Parameters:
    `toBeFound` - the given character
    `array` - the given array
  Returns:
    the number of occurrences of the given character in the given array, 0 if any
  Throws:
    `NullPointerException` - if array is null

### occurencesOf

    public static final int occurencesOf(char toBeFound,
                                         char[] array,
                                         int start)

  Answers the number of occurrences of the given character in the given array starting at the given index, 0 if any.
  For example:

  1.         toBeFound = 'b'
             array = { 'a' , 'b', 'b', 'a', 'b', 'a' }
             start = 2
             result => 2

  2.         toBeFound = 'c'
             array = { 'a' , 'b', 'b', 'a', 'b', 'a' }
             start = 0
             result => 0

  Parameters:
    `toBeFound` - the given character
    `array` - the given array
    `start` - the given index
  Returns:
    the number of occurrences of the given character in the given array, 0 if any
  Throws:
    `NullPointerException` - if array is null
    `ArrayIndexOutOfBoundsException` - if start is lower than 0

### prefixEquals

    public static final boolean prefixEquals(char[] prefix,
                                             char[] name)

  Answers true if the given name starts with the given prefix, false otherwise. The comparison is case sensitive.
  For example:

  1.         prefix = { 'a' , 'b' }
             name = { 'a' , 'b', 'b', 'a', 'b', 'a' }
             result => true

  2.         prefix = { 'a' , 'c' }
             name = { 'a' , 'b', 'b', 'a', 'b', 'a' }
             result => false

  Parameters:
    `prefix` - the given prefix
    `name` - the given name
  Returns:
    true if the given name starts with the given prefix, false otherwise
  Throws:
    `NullPointerException` - if the given name is null or if the given prefix is null

### prefixEquals

    public static final boolean prefixEquals(char[] prefix,
                                             char[] name,
                                             boolean isCaseSensitive)

  Answers true if the given name starts with the given prefix, false otherwise. isCaseSensitive is used to find out whether or not the comparison should be case sensitive.
  For example:

  1.         prefix = { 'a' , 'B' }
             name = { 'a' , 'b', 'b', 'a', 'b', 'a' }
             isCaseSensitive = false
             result => true

  2.         prefix = { 'a' , 'B' }
             name = { 'a' , 'b', 'b', 'a', 'b', 'a' }
             isCaseSensitive = true
             result => false

  Parameters:
    `prefix` - the given prefix
    `name` - the given name
    `isCaseSensitive` - to find out whether or not the comparison should be case sensitive
  Returns:
    true if the given name starts with the given prefix, false otherwise
  Throws:
    `NullPointerException` - if the given name is null or if the given prefix is null

### replace

    public static final void replace(char[] array,
                                     char toBeReplaced,
                                     char replacementChar)

  Replace all occurrence of the character to be replaced with the remplacement character in the given array.
  For example:

  1.         array = { 'a' , 'b', 'b', 'a', 'b', 'a' }
             toBeReplaced = 'b'
             replacementChar = 'a'
             result => No returned value, but array is now equals to { 'a' , 'a', 'a', 'a', 'a', 'a' }

  2.         array = { 'a' , 'b', 'b', 'a', 'b', 'a' }
             toBeReplaced = 'c'
             replacementChar = 'a'
             result => No returned value, but array is now equals to { 'a' , 'b', 'b', 'a', 'b', 'a' }

  Parameters:
    `array` - the given array
    `toBeReplaced` - the character to be replaced
    `replacementChar` - the replacement character
  Throws:
    `NullPointerException` - if the given array is null

### replace

    public static final char[] replace(char[] array,
                                       char[] toBeReplaced,
                                       char[] replacementChars)

  Answers a new array of characters with substitutions. No side-effect is operated on the original array, in case no substitution happened, then the result is the same as the original one.
  For example:

  1.         array = { 'a' , 'b', 'b', 'a', 'b', 'a' }
             toBeReplaced = { 'b' }
             replacementChar = { 'a', 'a' }
             result => { 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a' }

  2.         array = { 'a' , 'b', 'b', 'a', 'b', 'a' }
             toBeReplaced = { 'c' }
             replacementChar = { 'a' }
             result => { 'a' , 'b', 'b', 'a', 'b', 'a' }

  Parameters:
    `array` - the given array
    `toBeReplaced` - characters to be replaced
    `replacementChars` - the replacement characters
  Returns:
    a new array of characters with substitutions or the given array if none
  Throws:
    `NullPointerException` - if the given array is null

### splitAndTrimOn

    public static final char[][] splitAndTrimOn(char divider,
                                                char[] array)

  Return a new array which is the split of the given array using the given divider and triming each subarray to remove whitespaces equals to ' '.
  For example:

  1.         divider = 'b'
             array = { 'a' , 'b', 'b', 'a', 'b', 'a' }
             result => { { 'a' }, {  }, { 'a' }, { 'a' } }

  2.         divider = 'c'
             array = { 'a' , 'b', 'b', 'a', 'b', 'a' }
             result => { { 'a', 'b', 'b', 'a', 'b', 'a' } }

  3.         divider = 'b'
             array = { 'a' , ' ', 'b', 'b', 'a', 'b', 'a' }
             result => { { 'a' }, {  }, { 'a' }, { 'a' } }

  4.         divider = 'c'
             array = { ' ', ' ', 'a' , 'b', 'b', 'a', 'b', 'a', ' ' }
             result => { { 'a', 'b', 'b', 'a', 'b', 'a' } }

  Parameters:
    `divider` - the given divider
    `array` - the given array
  Returns:
    a new array which is the split of the given array using the given divider and triming each subarray to remove whitespaces equals to ' '

### splitOn

    public static final char[][] splitOn(char divider,
                                         char[] array)

  Return a new array which is the split of the given array using the given divider.
  For example:

  1.         divider = 'b'
             array = { 'a' , 'b', 'b', 'a', 'b', 'a' }
             result => { { 'a' }, {  }, { 'a' }, { 'a' } }

  2.         divider = 'c'
             array = { 'a' , 'b', 'b', 'a', 'b', 'a' }
             result => { { 'a', 'b', 'b', 'a', 'b', 'a' } }

  3.         divider = 'c'
             array = { ' ', ' ', 'a' , 'b', 'b', 'a', 'b', 'a', ' ' }
             result => { { ' ', 'a', 'b', 'b', 'a', 'b', 'a', ' ' } }

  Parameters:
    `divider` - the given divider
    `array` - the given array
  Returns:
    a new array which is the split of the given array using the given divider

### splitOn

    public static final char[][] splitOn(char divider,
                                         char[] array,
                                         int start,
                                         int end)

  Return a new array which is the split of the given array using the given divider. The given end is exclusive and the given start is inclusive.
  For example:

  1.         divider = 'b'
             array = { 'a' , 'b', 'b', 'a', 'b', 'a' }
             start = 2
             end = 5
             result => { {  }, { 'a' }, {  } }

  Parameters:
    `divider` - the given divider
    `array` - the given array
    `start` - the given starting index
    `end` - the given ending index
  Returns:
    a new array which is the split of the given array using the given divider
  Throws:
    `ArrayIndexOutOfBoundsException` - if start is lower than 0 or end is greater than the array length

### subarray

    public static final char[][] subarray(char[][] array,
                                          int start,
                                          int end)

  Answers a new array which is a copy of the given array starting at the given start and ending at the given end. The given start is inclusive and the given end is exclusive. Answers null if start is greater than end, if start is lower than 0 or if end is greater than the length of the given array. If end equals -1, it is converted to the array length.
  For example:

  1.         array = { { 'a' } , { 'b' } }
             start = 0
             end = 1
             result => { { 'a' } }

  2.         array = { { 'a' } , { 'b' } }
             start = 0
             end = -1
             result => { { 'a' }, { 'b' } }

  Parameters:
    `array` - the given array
    `start` - the given starting index
    `end` - the given ending index
  Returns:
    a new array which is a copy of the given array starting at the given start and ending at the given end
  Throws:
    `NullPointerException` - if the given array is null

### subarray

    public static final char[] subarray(char[] array,
                                        int start,
                                        int end)

  Answers a new array which is a copy of the given array starting at the given start and ending at the given end. The given start is inclusive and the given end is exclusive. Answers null if start is greater than end, if start is lower than 0 or if end is greater than the length of the given array. If end equals -1, it is converted to the array length.
  For example:

  1.         array = { 'a' , 'b' }
             start = 0
             end = 1
             result => { 'a' }

  2.         array = { 'a', 'b' }
             start = 0
             end = -1
             result => { 'a' , 'b' }

  Parameters:
    `array` - the given array
    `start` - the given starting index
    `end` - the given ending index
  Returns:
    a new array which is a copy of the given array starting at the given start and ending at the given end
  Throws:
    `NullPointerException` - if the given array is null

### toLowerCase

    public static final char[] toLowerCase(char[] chars)

  Answers the result of a char[] conversion to lowercase. Answers null if the given chars array is null.
  NOTE: If no conversion was necessary, then answers back the argument one.
  For example:

  1.         chars = { 'a' , 'b' }
             result => { 'a' , 'b' }

  2.         array = { 'A', 'b' }
             result => { 'a' , 'b' }

  Parameters:
    `chars` - the chars to convert
  Returns:
    the result of a char[] conversion to lowercase

### trim

    public static final char[] trim(char[] chars)

  Answers a new array removing leading and trailing spaces (' '). Answers the given array if there is no space characters to remove.
  For example:

  1.         chars = { ' ', 'a' , 'b', ' ',  ' ' }
             result => { 'a' , 'b' }

  2.         array = { 'A', 'b' }
             result => { 'A' , 'b' }

  Parameters:
    `chars` - the given array
  Returns:
    a new array removing leading and trailing spaces (' ')

### toString

    public static final String toString(char[][] array)

  Answers a string which is the concatenation of the given array using the '.' as a separator.
  For example:

  1.         array = { { 'a' } , { 'b' } }
             result => "a.b"

  2.         array = { { ' ',  'a' } , { 'b' } }
             result => " a.b"

  Parameters:
    `array` - the given array
  Returns:
    a string which is the concatenation of the given array using the '.' as a separator

### toStrings

    public static final String[] toStrings(char[][] array)

  Answers an array of strings from the given array of char array.

  Parameters:
    `array` - the given array
  Returns:
    an array of strings
  Since:
    3.0

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Eclipse JDT Release 3.0
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright (c) IBM Corp. and others 2000, 2004. All Rights Reserved.