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
Restriction:
This class is not intended to be instantiated by clients.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final char[]
    Constant for all Prefix
    static final char[]
    Constant for comma
    static final char[]
    Constant for an empty char array
    static final char[][]
    Constant for an empty char array with two dimensions.
    static final String[]
    Constant for an empty String array.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static final char[]
    append(char[] array, char suffix)
    Answers a new array with appending the suffix character at the end of the array.
    static final char[]
    append(char[] target, char[] suffix)
    Answers a new array with appending the sub-array at the end of the array.
    static final char[]
    append(char[] target, int index, char[] array, int start, int end)
    Append the given sub-array to the target array starting at the given index in the target array.
    static final char[][]
    arrayConcat(char[][] first, char[] second)
    Answers a new array adding the second array at the end of first array.
    static final char[][]
    arrayConcat(char[][] first, char[][] second)
    Answers the concatenation of the two arrays.
    static final boolean
    camelCaseMatch(char[] pattern, char[] name)
    Answers true if the pattern matches the given name using CamelCase rules, or false otherwise. char[] CamelCase matching does NOT accept explicit wild-cards '*' and '?'
    static final boolean
    camelCaseMatch(char[] pattern, char[] name, boolean samePartCount)
    Answers true if the pattern matches the given name using CamelCase rules, or false otherwise. char[] CamelCase matching does NOT accept explicit wild-cards '*' and '?'
    static final boolean
    camelCaseMatch(char[] pattern, int patternStart, int patternEnd, char[] name, int nameStart, int nameEnd)
    Answers true if a sub-pattern matches the sub-part of the given name using CamelCase rules, or false otherwise.
    static final boolean
    camelCaseMatch(char[] pattern, int patternStart, int patternEnd, char[] name, int nameStart, int nameEnd, boolean samePartCount)
    Answers true if a sub-pattern matches the sub-part of the given name using CamelCase rules, or false otherwise.
    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 final int
    compareTo(char[] array1, char[] array2)
    Compares the two char arrays lexicographically.
    static final int
    compareTo(char[] array1, char[] array2, int start, int end)
    Compares the two char arrays lexicographically between the given start and end positions.
    static final int
    compareWith(char[] array, char[] prefix)
    Compares the contents of the two arrays array and prefix.
    static final char[]
    concat(char[] first, char[] second)
    Answers the concatenation of the two arrays.
    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.
    static final char[]
    concat(char[] first, char[] second, char[] third)
    Answers the concatenation of the three arrays.
    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 first two arrays and sep2 between the last two.
    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.
    static final char[]
    concatAll(char[] first, char[] second, char separator)
    Answers the concatenation of the two arrays inserting the separator character between the two arrays.
    static final char[]
    concatNonEmpty(char[] first, char[] second, char separator)
    Answers the concatenation of the two arrays inserting the separator character between the two arrays.
    static final char[]
    concatNonEmpty(char[] first, char sep1, char[] second, char sep2, char[] third)
    Answers the concatenation of the three arrays inserting the sep1 character between the first two arrays and sep2 between the last two.
    static final char[]
    concatWith(char[][] array, char separator)
    Answers the concatenation of the given array parts using the given separator between each part.
    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.
    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 prepending the given name at the beginning.
    static final char[]
    concatWithAll(char[][] array, char separator)
    Answers the concatenation of the given array parts using the given separator between each part irrespective of whether an element is a zero length array or not.
    static final boolean
    contains(char[] characters, char[] array)
    Answers true if the array contains an occurrence of one of the characters, false otherwise.
    static final boolean
    contains(char character, char[] array)
    Answers true if the array contains an occurrence of character, false otherwise.
    static final boolean
    contains(char character, char[][] array)
    Answers true if the array contains an occurrence of character, false otherwise.
    static boolean
    containsEqual(char[][] array, char[] sequence)
    Does the given array contain a char sequence that is equal to the give sequence?
    static final char[][]
    deepCopy(char[][] toCopy)
    Answers a deep copy of the toCopy array.
    static final boolean
    endsWith(char[] array, char[] toBeFound)
    Return true if array ends with the sequence of characters contained in toBeFound, otherwise false.
    static final boolean
    equals(char[][] first, char[][] second)
    Answers true if the two arrays are identical character by character, otherwise false.
    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.
    static final boolean
    equals(char[] first, char[] second)
    Answers true if the two arrays are identical character by character, otherwise false.
    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.
    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.
    static final boolean
    equals(char[] first, char[] second, int secondStart, int secondEnd, boolean isCaseSensitive)
    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 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.
    static final int[]
    Answers all the regions in a given name matching a subword pattern.
    static final int
    hashCode(char[] array)
    Answers a hashcode for the array
    static final int
    indexOf(char[] toBeFound, char[] array, boolean isCaseSensitive)
    Answers the first index in the array for which the toBeFound array is a matching subarray following the case rule.
    static final int
    indexOf(char[] toBeFound, char[] array, boolean isCaseSensitive, int start)
    Answers the first index in the array for which the toBeFound array is a matching subarray following the case rule starting at the index start.
    static final int
    indexOf(char[] toBeFound, char[] array, boolean isCaseSensitive, int start, int end)
    Answers the first index in the array for which the toBeFound array is a matching subarray following the case rule starting at the index start.
    static final int
    indexOf(char toBeFound, char[] array)
    Answers the first index in the array for which the corresponding character is equal to toBeFound.
    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.
    static final int
    indexOf(char toBeFound, char[] array, int start, int end)
    Answers the first index in the array for which the corresponding character is equal to toBeFound starting the search at index start and before the ending index.
    static boolean
    isWhitespace(char c)
    Answers true if c is a whitespace according to the JLS (\u0009, \u000a, \u000c, \u000d, \u0020), otherwise false.
    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.
    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.
    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.
    static final char[]
    lastSegment(char[] array, char separator)
    Answers the last portion of a name given a separator.
    static final boolean
    match(char[] pattern, char[] name, boolean isCaseSensitive)
    Answers true if the pattern matches the given name, false otherwise.
    static final boolean
    match(char[] pattern, int patternStart, int patternEnd, char[] name, int nameStart, int nameEnd, boolean isCaseSensitive)
    Answers true if a sub-pattern matches the subpart of the given name, false otherwise.
    static final int
    occurencesOf(char toBeFound, char[] array)
    Answers the number of occurrences of the given character in the given array, 0 if any.
    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.
    static final int
    parseInt(char[] array, int start, int length)
    Return the int value represented by the designated subpart of array.
    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.
    static final boolean
    prefixEquals(char[] prefix, char[] name)
    Answers true if the given name starts with the given prefix, false otherwise.
    static final boolean
    prefixEquals(char[] prefix, char[] name, boolean isCaseSensitive)
    Answers true if the given name starts with the given prefix, false otherwise.
    static final boolean
    prefixEquals(char[] prefix, char[] name, boolean isCaseSensitive, int startIndex)
    Answers true if the given name, starting from the given index, starts with the given prefix, false otherwise. isCaseSensitive is used to find out whether or not the comparison should be case sensitive.
    static final char[]
    prepend(char prefix, char[] array)
    Answers a new array with prepending the prefix character at the start of the array.
    static final char[]
    remove(char[] array, char toBeRemoved)
    Answers a new array removing a given character.
    static final void
    replace(char[] array, char[] toBeReplaced, char replacementChar)
    Replace all occurrences of characters to be replaced with the replacement character in the given array.
    static final char[]
    replace(char[] array, char[] toBeReplaced, char[] replacementChars)
    Answers a new array of characters with substitutions.
    static final void
    replace(char[] array, char[] toBeReplaced, char replacementChar, int start, int end)
    Replace all occurrences of characters to be replaced with the replacement character in the given array from the start position (inclusive) to the end position (exclusive).
    static final void
    replace(char[] array, char toBeReplaced, char replacementChar)
    Replace all occurrence of the character to be replaced with the replacement character in the given array.
    static final char[]
    replaceOnCopy(char[] array, char toBeReplaced, char replacementChar)
    Replace all occurrence of the character to be replaced with the replacement character in a copy of the given array.
    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 trimming each subarray to remove whitespaces equals to ' '.
    static final char[][]
    splitOn(char divider, char[] array)
    Return a new array which is the split of the given array using the given divider.
    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.
    static final char[][]
    splitOnWithEnclosures(char divider, char openEncl, char closeEncl, char[] array, int start, int end)
    Return a new array which is the split of the given array using the given divider ignoring the text between (possibly nested) openEncl and closingEncl.
    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.
    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.
    static final boolean
    substringMatch(char[] pattern, char[] name)
    Answers true if the characters of the pattern are contained in the name as a substring, in a case-insensitive way.
    static final boolean
    substringMatch(String pattern, String name)
    Answers true if the characters of the pattern are contained in the name as a substring, in a case-insensitive way.
    static final boolean
    subWordMatch(char[] pattern, char[] name)
    Answers true if the characters of the pattern are contained in the name as a subword, in a case-insensitive way.
    static char[][]
    toCharArrays(List<String> stringList)
    Converts the given list of strings to an array of equal size, containing the individual strings converted to char[] each.
    static final char[]
    toLowerCase(char[] chars)
    Answers the result of a char[] conversion to lowercase.
    static final String
    toString(char[][] array)
    Answers a string which is the concatenation of the given array using the '.' as a separator.
    static final String[]
    toStrings(char[][] array)
    Answers an array of strings from the given array of char array.
    static final char[]
    toUpperCase(char[] chars)
    Answers the result of a char[] conversion to uppercase.
    static final 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 Details

    • 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.
    • NO_STRINGS

      public static final String[] NO_STRINGS
      Constant for an empty String array.
      Since:
      3.1
    • ALL_PREFIX

      public static final char[] ALL_PREFIX
      Constant for all Prefix
      Since:
      3.14
    • COMMA_SEPARATOR

      public static final char[] COMMA_SEPARATOR
      Constant for comma
      Since:
      3.14
  • Constructor Details

    • CharOperation

      public CharOperation()
  • Method Details

    • 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 concatenated with the suffix character
      suffix - the suffix character
      Returns:
      the new array
    • append

      public static final char[] append(char[] target, char[] suffix)
      Answers a new array with appending the sub-array at the end of the array.

      For example:
      1.     array = { 'a', 'b' }
            suffix = { 'c', 'd' }
            => result = { 'a', 'b' , 'c' , d' }
         
      2.     array = null
            suffix = { 'c' }
            => result = { 'c' }
         
      Parameters:
      target - the array that is concatenated with the suffix array.
      suffix - the array that will be concatenated to the target
      Returns:
      the new array
      Throws:
      NullPointerException - if the target array is null
      Since:
      3.11
    • append

      public static final char[] append(char[] target, int index, char[] array, int start, int end)
      Append the given sub-array to the target array starting at the given index in the target array. The start of the sub-array 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
    • prepend

      public static final char[] prepend(char prefix, char[] array)
      Answers a new array with prepending the prefix character at the start of the array.

      For example:
      1.     prefix = 'c'
            array = { 'a', 'b' }
            => result = { 'c' , 'a', 'b' }
         
      2.     prefix = 'c'
            array = null
            => result = { 'c' }
         
      Parameters:
      array - the array that is concatenated with the prefix character
      prefix - the prefix character
      Returns:
      the new array
      Since:
      3.14
    • 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.
    • camelCaseMatch

      public static final boolean camelCaseMatch(char[] pattern, char[] name)
      Answers true if the pattern matches the given name using CamelCase rules, or false otherwise. char[] CamelCase matching does NOT accept explicit wild-cards '*' and '?' and is inherently case sensitive.

      CamelCase denotes the convention of writing compound names without spaces, and capitalizing every term. This function recognizes both upper and lower CamelCase, depending whether the leading character is capitalized or not. The leading part of an upper CamelCase pattern is assumed to contain a sequence of capitals which are appearing in the matching name; e.g. 'NPE' will match 'NullPointerException', but not 'NewPerfData'. A lower CamelCase pattern uses a lowercase first character. In Java, type names follow the upper CamelCase convention, whereas method or field names follow the lower CamelCase convention.

      The pattern may contain lowercase characters, which will be matched in a case sensitive way. These characters must appear in sequence in the name. For instance, 'NPExcep' will match 'NullPointerException', but not 'NullPointerExCEPTION' or 'NuPoEx' will match 'NullPointerException', but not 'NoPointerException'.

      Digit characters are treated in a special way. They can be used in the pattern but are not always considered as leading character. For instance, both 'UTF16DSS' and 'UTFDSS' patterns will match 'UTF16DocumentScannerSupport'.

      Using this method allows matching names to have more parts than the specified pattern (see camelCaseMatch(char[], char[], boolean)).
      For instance, 'HM' , 'HaMa' and 'HMap' patterns will match 'HashMap', 'HatMapper' and also 'HashMapEntry'.

      Examples:

      1. pattern = "NPE".toCharArray() name = "NullPointerException".toCharArray() result => true
      2. pattern = "NPE".toCharArray() name = "NoPermissionException".toCharArray() result => true
      3. pattern = "NuPoEx".toCharArray() name = "NullPointerException".toCharArray() result => true
      4. pattern = "NuPoEx".toCharArray() name = "NoPermissionException".toCharArray() result => false
      5. pattern = "npe".toCharArray() name = "NullPointerException".toCharArray() result => false
      6. pattern = "IPL3".toCharArray() name = "IPerspectiveListener3".toCharArray() result => true
      7. pattern = "HM".toCharArray() name = "HashMapEntry".toCharArray() result => true
      Parameters:
      pattern - the given pattern
      name - the given name
      Returns:
      true if the pattern matches the given name, false otherwise
      Since:
      3.2
    • camelCaseMatch

      public static final boolean camelCaseMatch(char[] pattern, char[] name, boolean samePartCount)
      Answers true if the pattern matches the given name using CamelCase rules, or false otherwise. char[] CamelCase matching does NOT accept explicit wild-cards '*' and '?' and is inherently case sensitive.

      CamelCase denotes the convention of writing compound names without spaces, and capitalizing every term. This function recognizes both upper and lower CamelCase, depending whether the leading character is capitalized or not. The leading part of an upper CamelCase pattern is assumed to contain a sequence of capitals which are appearing in the matching name; e.g. 'NPE' will match 'NullPointerException', but not 'NewPerfData'. A lower CamelCase pattern uses a lowercase first character. In Java, type names follow the upper CamelCase convention, whereas method or field names follow the lower CamelCase convention.

      The pattern may contain lowercase characters, which will be matched in a case sensitive way. These characters must appear in sequence in the name. For instance, 'NPExcep' will match 'NullPointerException', but not 'NullPointerExCEPTION' or 'NuPoEx' will match 'NullPointerException', but not 'NoPointerException'.

      Digit characters are treated in a special way. They can be used in the pattern but are not always considered as leading character. For instance, both 'UTF16DSS' and 'UTFDSS' patterns will match 'UTF16DocumentScannerSupport'.

      CamelCase can be restricted to match only the same count of parts. When this restriction is specified the given pattern and the given name must have exactly the same number of parts (i.e. the same number of uppercase characters).
      For instance, 'HM' , 'HaMa' and 'HMap' patterns will match 'HashMap' and 'HatMapper' but not 'HashMapEntry'.

      Examples:

      1. pattern = "NPE".toCharArray() name = "NullPointerException".toCharArray() result => true
      2. pattern = "NPE".toCharArray() name = "NoPermissionException".toCharArray() result => true
      3. pattern = "NuPoEx".toCharArray() name = "NullPointerException".toCharArray() result => true
      4. pattern = "NuPoEx".toCharArray() name = "NoPermissionException".toCharArray() result => false
      5. pattern = "npe".toCharArray() name = "NullPointerException".toCharArray() result => false
      6. pattern = "IPL3".toCharArray() name = "IPerspectiveListener3".toCharArray() result => true
      7. pattern = "HM".toCharArray() name = "HashMapEntry".toCharArray() result => (samePartCount == false)
      Parameters:
      pattern - the given pattern
      name - the given name
      samePartCount - flag telling whether the pattern and the name should have the same count of parts or not.
        For example:
      • 'HM' type string pattern will match 'HashMap' and 'HtmlMapper' types, but not 'HashMapEntry'
      • 'HMap' type string pattern will still match previous 'HashMap' and 'HtmlMapper' types, but not 'HighMagnitude'
      Returns:
      true if the pattern matches the given name, false otherwise
      Since:
      3.4
    • camelCaseMatch

      public static final boolean camelCaseMatch(char[] pattern, int patternStart, int patternEnd, char[] name, int nameStart, int nameEnd)
      Answers true if a sub-pattern matches the sub-part of the given name using CamelCase rules, or false otherwise. char[] CamelCase matching does NOT accept explicit wild-cards '*' and '?' and is inherently case sensitive. Can match only subset of name/pattern, considering end positions as non-inclusive. The sub-pattern is defined by the patternStart and patternEnd positions.

      CamelCase denotes the convention of writing compound names without spaces, and capitalizing every term. This function recognizes both upper and lower CamelCase, depending whether the leading character is capitalized or not. The leading part of an upper CamelCase pattern is assumed to contain a sequence of capitals which are appearing in the matching name; e.g. 'NPE' will match 'NullPointerException', but not 'NewPerfData'. A lower CamelCase pattern uses a lowercase first character. In Java, type names follow the upper CamelCase convention, whereas method or field names follow the lower CamelCase convention.

      The pattern may contain lowercase characters, which will be matched in a case sensitive way. These characters must appear in sequence in the name. For instance, 'NPExcep' will match 'NullPointerException', but not 'NullPointerExCEPTION' or 'NuPoEx' will match 'NullPointerException', but not 'NoPointerException'.

      Digit characters are treated in a special way. They can be used in the pattern but are not always considered as leading character. For instance, both 'UTF16DSS' and 'UTFDSS' patterns will match 'UTF16DocumentScannerSupport'.

      Digit characters are treated in a special way. They can be used in the pattern but are not always considered as leading character. For instance, both 'UTF16DSS' and 'UTFDSS' patterns will match 'UTF16DocumentScannerSupport'.

      Using this method allows matching names to have more parts than the specified pattern (see camelCaseMatch(char[], int, int, char[], int, int, boolean)).
      For instance, 'HM' , 'HaMa' and 'HMap' patterns will match 'HashMap', 'HatMapper' and also 'HashMapEntry'.

      Examples:

      1. pattern = "NPE".toCharArray() patternStart = 0 patternEnd = 3 name = "NullPointerException".toCharArray() nameStart = 0 nameEnd = 20 result => true
      2. pattern = "NPE".toCharArray() patternStart = 0 patternEnd = 3 name = "NoPermissionException".toCharArray() nameStart = 0 nameEnd = 21 result => true
      3. pattern = "NuPoEx".toCharArray() patternStart = 0 patternEnd = 6 name = "NullPointerException".toCharArray() nameStart = 0 nameEnd = 20 result => true
      4. pattern = "NuPoEx".toCharArray() patternStart = 0 patternEnd = 6 name = "NoPermissionException".toCharArray() nameStart = 0 nameEnd = 21 result => false
      5. pattern = "npe".toCharArray() patternStart = 0 patternEnd = 3 name = "NullPointerException".toCharArray() nameStart = 0 nameEnd = 20 result => false
      6. pattern = "IPL3".toCharArray() patternStart = 0 patternEnd = 4 name = "IPerspectiveListener3".toCharArray() nameStart = 0 nameEnd = 21 result => true
      7. pattern = "HM".toCharArray() patternStart = 0 patternEnd = 2 name = "HashMapEntry".toCharArray() nameStart = 0 nameEnd = 12 result => true
      Parameters:
      pattern - the given pattern
      patternStart - the start index of the pattern, inclusive
      patternEnd - the end index of the pattern, exclusive
      name - the given name
      nameStart - the start index of the name, inclusive
      nameEnd - the end index of the name, exclusive
      Returns:
      true if a sub-pattern matches the sub-part of the given name, false otherwise
      Since:
      3.2
    • camelCaseMatch

      public static final boolean camelCaseMatch(char[] pattern, int patternStart, int patternEnd, char[] name, int nameStart, int nameEnd, boolean samePartCount)
      Answers true if a sub-pattern matches the sub-part of the given name using CamelCase rules, or false otherwise. char[] CamelCase matching does NOT accept explicit wild-cards '*' and '?' and is inherently case sensitive. Can match only subset of name/pattern, considering end positions as non-inclusive. The sub-pattern is defined by the patternStart and patternEnd positions.

      CamelCase denotes the convention of writing compound names without spaces, and capitalizing every term. This function recognizes both upper and lower CamelCase, depending whether the leading character is capitalized or not. The leading part of an upper CamelCase pattern is assumed to contain a sequence of capitals which are appearing in the matching name; e.g. 'NPE' will match 'NullPointerException', but not 'NewPerfData'. A lower CamelCase pattern uses a lowercase first character. In Java, type names follow the upper CamelCase convention, whereas method or field names follow the lower CamelCase convention.

      The pattern may contain lowercase characters, which will be matched in a case sensitive way. These characters must appear in sequence in the name. For instance, 'NPExcep' will match 'NullPointerException', but not 'NullPointerExCEPTION' or 'NuPoEx' will match 'NullPointerException', but not 'NoPointerException'.

      Digit characters are treated in a special way. They can be used in the pattern but are not always considered as leading character. For instance, both 'UTF16DSS' and 'UTFDSS' patterns will match 'UTF16DocumentScannerSupport'.

      CamelCase can be restricted to match only the same count of parts. When this restriction is specified the given pattern and the given name must have exactly the same number of parts (i.e. the same number of uppercase characters).
      For instance, 'HM' , 'HaMa' and 'HMap' patterns will match 'HashMap' and 'HatMapper' but not 'HashMapEntry'.

      Examples:

      1. pattern = "NPE".toCharArray() patternStart = 0 patternEnd = 3 name = "NullPointerException".toCharArray() nameStart = 0 nameEnd = 20 result => true
      2. pattern = "NPE".toCharArray() patternStart = 0 patternEnd = 3 name = "NoPermissionException".toCharArray() nameStart = 0 nameEnd = 21 result => true
      3. pattern = "NuPoEx".toCharArray() patternStart = 0 patternEnd = 6 name = "NullPointerException".toCharArray() nameStart = 0 nameEnd = 20 result => true
      4. pattern = "NuPoEx".toCharArray() patternStart = 0 patternEnd = 6 name = "NoPermissionException".toCharArray() nameStart = 0 nameEnd = 21 result => false
      5. pattern = "npe".toCharArray() patternStart = 0 patternEnd = 3 name = "NullPointerException".toCharArray() nameStart = 0 nameEnd = 20 result => false
      6. pattern = "IPL3".toCharArray() patternStart = 0 patternEnd = 4 name = "IPerspectiveListener3".toCharArray() nameStart = 0 nameEnd = 21 result => true
      7. pattern = "HM".toCharArray() patternStart = 0 patternEnd = 2 name = "HashMapEntry".toCharArray() nameStart = 0 nameEnd = 12 result => (samePartCount == false)
      Parameters:
      pattern - the given pattern
      patternStart - the start index of the pattern, inclusive
      patternEnd - the end index of the pattern, exclusive
      name - the given name
      nameStart - the start index of the name, inclusive
      nameEnd - the end index of the name, exclusive
      samePartCount - flag telling whether the pattern and the name should have the same count of parts or not.
        For example:
      • 'HM' type string pattern will match 'HashMap' and 'HtmlMapper' types, but not 'HashMapEntry'
      • 'HMap' type string pattern will still match previous 'HashMap' and 'HtmlMapper' types, but not 'HighMagnitude'
      Returns:
      true if a sub-pattern matches the sub-part of the given name, false otherwise
      Since:
      3.4
    • subWordMatch

      public static final boolean subWordMatch(char[] pattern, char[] name)
      Answers true if the characters of the pattern are contained in the name as a subword, in a case-insensitive way.
      Parameters:
      pattern - the given pattern
      name - the given name
      Returns:
      true if the pattern matches the given name, false otherwise
      Since:
      3.21
    • getSubWordMatchingRegions

      public static final int[] getSubWordMatchingRegions(String pattern, String name)
      Answers all the regions in a given name matching a subword pattern.

      Each of these regions is made of its starting index and its length in the given name. They are all concatenated in a single array of int which therefore always has an even length.

      Note that each region is disjointed from the following one.
      E.g. if the regions are { start1, length1, start2, length2 }, then start1+length1 will always be smaller than start2.

      Examples:

      1.     pattern = "linkedmap"
            name = LinkedHashMap
            result:  { 0, 6, 10, 3 }
         
      Parameters:
      pattern - the given pattern
      name - the given name
      Returns:
      an array of int having two slots per returned regions (first one is the starting index of the region and the second one the length of the region).
      Note that it may be null if the given name does not match the pattern
      Since:
      3.21
      See Also:
    • substringMatch

      public static final boolean substringMatch(String pattern, String name)
      Answers true if the characters of the pattern are contained in the name as a substring, in a case-insensitive way.
      Parameters:
      pattern - the given pattern
      name - the given name
      Returns:
      true if the pattern matches the given name, false otherwise
      Since:
      3.12
    • substringMatch

      public static final boolean substringMatch(char[] pattern, char[] name)
      Answers true if the characters of the pattern are contained in the name as a substring, in a case-insensitive way.
      Parameters:
      pattern - the given pattern
      name - the given name
      Returns:
      true if the pattern matches the given name, false otherwise
      Since:
      3.12
    • 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
    • toCharArrays

      public static char[][] toCharArrays(List<String> stringList)
      Converts the given list of strings to an array of equal size, containing the individual strings converted to char[] each.
      Returns:
      an array of char[], representing the elements in the input list, or null if the list was null.
      Since:
      3.14
    • 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.
    • compareTo

      public static final int compareTo(char[] array1, char[] array2)
      Compares the two char arrays lexicographically. Returns a negative integer if array1 lexicographically precedes the array2, a positive integer if this array1 lexicographically follows the array2, or zero if both arrays are equal.
      Parameters:
      array1 - the first given array
      array2 - the second given array
      Returns:
      the returned value of the comparison between array1 and array2
      Throws:
      NullPointerException - if one of the arrays is null
      Since:
      3.3
    • compareTo

      public static final int compareTo(char[] array1, char[] array2, int start, int end)
      Compares the two char arrays lexicographically between the given start and end positions. Returns a negative integer if array1 lexicographically precedes the array2, a positive integer if this array1 lexicographically follows the array2, or zero if both arrays are equal.

      The comparison is done between start and end positions.

      Parameters:
      array1 - the first given array
      array2 - the second given array
      start - the starting position to compare (inclusive)
      end - the ending position to compare (exclusive)
      Returns:
      the returned value of the comparison between array1 and array2
      Throws:
      NullPointerException - if one of the arrays is null
      Since:
      3.7.1
    • 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.
    • concatAll

      public static final char[] concatAll(char[] first, char[] second, char separator)
      Answers the concatenation of the two arrays inserting the separator character between the two arrays. Differs from contains(char, char[]) in case second array is a zero length array. 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. if the second array is zero length array, the separator is appended.

      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' }
         
      4.     first = { ' a' }
            second = { '' }
            separator = '.'
            => result = { ' a' , '.', }
         
      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. If second array is of zero length, the separator is appended to the first array and returned.
      Since:
      3.14
    • 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 first 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.
    • concatNonEmpty

      public static final char[] concatNonEmpty(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 or is empty, then the second array is returned. If the second array is null or is empty, 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' }
         
      4.     first = { ' a' }
            second = {  }
            separator = '/'
            => result = { ' a'}
         
      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.
      Since:
      3.12
    • concatNonEmpty

      public static final char[] concatNonEmpty(char[] first, char sep1, char[] second, char sep2, char[] third)
      Answers the concatenation of the three arrays inserting the sep1 character between the first two arrays and sep2 between the last two. It answers null if the three arrays are null. If the first array is null or empty, then it answers the concatenation of second and third inserting the sep2 character between them. If the second array is null or empty, then it answers the concatenation of first and third inserting the sep1 character between them. If the third array is null or empty, 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' }
         
      5.     first = { 'a' }
            sep1 = '/'
            second = { }
            sep2 = ':'
            third = { 'c' }
            => result = { ' a', ':', '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.
      Since:
      3.12
    • 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 concatenated 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 prepending the given name at the beginning.

      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 prepending the given name at the beginning
    • 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
    • concatWithAll

      public static final char[] concatWithAll(char[][] array, char separator)
      Answers the concatenation of the given array parts using the given separator between each part irrespective of whether an element is a zero length array or not.

      For example:
      1.     array = { { 'a' }, {}, { 'b' } }
            separator = ''
            => result = { 'a', '/', '/', 'b' }
         
      2.     array = { { 'a' }, { 'b' } }
            separator = '.'
            => result = { 'a', '.', 'b' }
         
      3.     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
      Since:
      3.12
    • 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.
    • contains

      public static final boolean contains(char[] characters, char[] array)
      Answers true if the array contains an occurrence of one of the characters, false otherwise.

      For example:
      1.     characters = { 'c', 'd' }
            array = { 'a', ' b'  }
            result => false
         
      2.     characters = { 'c', 'd' }
            array = { 'a', ' b', 'c'  }
            result => true
         
      Parameters:
      characters - the characters to search
      array - the array in which the search is done
      Returns:
      true if the array contains an occurrence of one of the characters, false otherwise.
      Throws:
      NullPointerException - if array is null.
      Since:
      3.1
    • containsEqual

      public static boolean containsEqual(char[][] array, char[] sequence)
      Does the given array contain a char sequence that is equal to the give sequence?
      Returns:
      true if sequence is equal to an element in array
      Since:
      3.14
    • 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, int secondStart, int secondEnd, boolean isCaseSensitive)

      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 could be either case sensitive or case insensitive according to the value of the isCaseSensitive parameter.

      For example:

      1.     first = null
            second = null
            secondStart = 0
            secondEnd = 0
            isCaseSensitive = false
            result => true
         
      2.     first = { }
            second = null
            secondStart = 0
            secondEnd = 0
            isCaseSensitive = false
            result => false
         
      3.     first = { 'a' }
            second = { 'a' }
            secondStart = 0
            secondEnd = 1
            isCaseSensitive = true
            result => true
         
      4.     first = { 'a' }
            second = { 'A' }
            secondStart = 0
            secondEnd = 1
            isCaseSensitive = true
            result => false
         
      5.     first = { 'a' }
            second = { 'A' }
            secondStart = 0
            secondEnd = 1
            isCaseSensitive = false
            result => true
         
      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
      isCaseSensitive - check whether or not the equality should be case sensitive
      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.2
    • 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
    • isWhitespace

      public static boolean isWhitespace(char c)
      Answers true if c is a whitespace according to the JLS (\u0009, \u000a, \u000c, \u000d, \u0020), 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, boolean isCaseSensitive)
      Answers the first index in the array for which the toBeFound array is a matching subarray following the case rule. Answers -1 if no match 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 subarray to search
      array - the array to be searched
      isCaseSensitive - flag to know if the matching should be case sensitive
      Returns:
      the first index in the array for which the toBeFound array is a matching subarray following the case rule, -1 otherwise
      Throws:
      NullPointerException - if array is null or toBeFound is null
      Since:
      3.2
    • indexOf

      public static final int indexOf(char[] toBeFound, char[] array, boolean isCaseSensitive, int start)
      Answers the first index in the array for which the toBeFound array is a matching subarray following the case rule starting at the index start. Answers -1 if no match 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 subarray to search
      array - the array to be searched
      isCaseSensitive - flag to know if the matching should be case sensitive
      start - the starting index
      Returns:
      the first index in the array for which the toBeFound array is a matching subarray following the case rule starting at the index start, -1 otherwise
      Throws:
      NullPointerException - if array is null or toBeFound is null
      Since:
      3.2
    • indexOf

      public static final int indexOf(char[] toBeFound, char[] array, boolean isCaseSensitive, int start, int end)
      Answers the first index in the array for which the toBeFound array is a matching subarray following the case rule starting at the index start. Answers -1 if no match 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 subarray to search
      array - the array to be searched
      isCaseSensitive - flag to know if the matching should be case sensitive
      start - the starting index (inclusive)
      end - the end index (exclusive)
      Returns:
      the first index in the array for which the toBeFound array is a matching subarray following the case rule starting at the index start, -1 otherwise
      Throws:
      NullPointerException - if array is null or toBeFound is null
      Since:
      3.2
    • 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
    • indexOf

      public static final int indexOf(char toBeFound, char[] array, int start, int end)
      Answers the first index in the array for which the corresponding character is equal to toBeFound starting the search at index start and before the ending index. 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 (inclusive)
      end - the ending index (exclusive)
      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 or ending greater than array length
      Since:
      3.2
    • 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 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 = 4
            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 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
    • parseInt

      public static final int parseInt(char[] array, int start, int length) throws NumberFormatException
      Return the int value represented by the designated subpart of array. The calculation of the result for single-digit positive integers is optimized in time.
      Parameters:
      array - the array within which the int value is to be parsed
      start - first character of the int value in array
      length - length of the int value in array
      Returns:
      the int value of a subpart of array
      Throws:
      NumberFormatException - if the designated subpart of array does not parse to an int
      Since:
      3.4
    • 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
    • prefixEquals

      public static final boolean prefixEquals(char[] prefix, char[] name, boolean isCaseSensitive, int startIndex)
      Answers true if the given name, starting from the given index, 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 = { 'c', 'd', 'a' , 'b', 'b', 'a', 'b', 'a' }
            startIndex = 2
            isCaseSensitive = false
            result => true
         
      2.     prefix = { 'a' , 'B' }
            name = { 'c', 'd', 'a' , 'b', 'b', 'a', 'b', 'a' }
            startIndex = 2
            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
      startIndex - index from which the prefix should be searched in the 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
      Since:
      3.7
    • remove

      public static final char[] remove(char[] array, char toBeRemoved)
      Answers a new array removing a given character. Answers the given array if there is no occurrence of the character to remove.

      For example:
      1.     array = { 'a' , 'b', 'b', 'c', 'b', 'a' }
            toBeRemoved = 'b'
            return { 'a' , 'c', 'a' }
         
      2.     array = { 'a' , 'b', 'b', 'a', 'b', 'a' }
            toBeRemoved = 'c'
            return array
         
      Parameters:
      array - the given array
      toBeRemoved - the character to be removed
      Returns:
      a new array removing given character
      Since:
      3.2
    • replace

      public static final void replace(char[] array, char toBeReplaced, char replacementChar)
      Replace all occurrence of the character to be replaced with the replacement 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 void replace(char[] array, char[] toBeReplaced, char replacementChar)
      Replace all occurrences of characters to be replaced with the replacement character in the given array.

      For example:
      1.     array = { 'a' , 'b', 'b', 'c', 'a', 'b', 'c', 'a' }
            toBeReplaced = { 'b', 'c' }
            replacementChar = 'a'
            result => No returned value, but array is now equals to { 'a' , 'a', 'a', 'a', 'a', 'a', 'a', 'a' }
         
      Parameters:
      array - the given array
      toBeReplaced - characters to be replaced
      replacementChar - the replacement character
      Throws:
      NullPointerException - if arrays are null.
      Since:
      3.1
    • replace

      public static final void replace(char[] array, char[] toBeReplaced, char replacementChar, int start, int end)
      Replace all occurrences of characters to be replaced with the replacement character in the given array from the start position (inclusive) to the end position (exclusive).

      For example:
      1.     array = { 'a' , 'b', 'b', 'c', 'a', 'b', 'c', 'a' }
            toBeReplaced = { 'b', 'c' }
            replacementChar = 'a'
            start = 4
            end = 8
            result => No returned value, but array is now equals to { 'a' , 'b', 'b', 'c', 'a', 'a', 'a', 'a' }
         
      Parameters:
      array - the given array
      toBeReplaced - characters to be replaced
      replacementChar - the replacement character
      start - the given start position (inclusive)
      end - the given end position (exclusive)
      Throws:
      NullPointerException - if arrays are null.
      Since:
      3.2
    • 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
    • replaceOnCopy

      public static final char[] replaceOnCopy(char[] array, char toBeReplaced, char replacementChar)
      Replace all occurrence of the character to be replaced with the replacement character in a copy of the given array. Returns the given array if no occurrences of the character to be replaced are found.

      For example:
      1.     array = { 'a' , 'b', 'b', 'a', 'b', 'a' }
            toBeReplaced = 'b'
            replacementChar = 'a'
            result => A new array that is equals to { 'a' , 'a', 'a', 'a', 'a', 'a' }
         
      2.     array = { 'a' , 'b', 'b', 'a', 'b', 'a' }
            toBeReplaced = 'c'
            replacementChar = 'a'
            result => The original array that remains unchanged.
         
      Parameters:
      array - the given array
      toBeReplaced - the character to be replaced
      replacementChar - the replacement character
      Throws:
      NullPointerException - if the given array is null
      Since:
      3.1
    • 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 trimming 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 trimming 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
    • splitOnWithEnclosures

      public static final char[][] splitOnWithEnclosures(char divider, char openEncl, char closeEncl, char[] array, int start, int end)
      Return a new array which is the split of the given array using the given divider ignoring the text between (possibly nested) openEncl and closingEncl. If there are no openEncl in the code this is identical to splitOn(char, char[], int, int). The given end is exclusive and the given start is inclusive.

      For example:
      1.  
            divider = ','
            array = { 'A' , '<', 'B', ',', 'C', '>', ',', 'D' }
            start = 0
            end = 8
            result => { {  'A' , '<', 'B', ',', 'C', '>'}, { 'D' }}
         
         
      Parameters:
      divider - the given divider
      openEncl - the opening enclosure
      closeEncl - the closing enclosure
      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
      Since:
      3.12
    • 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
    • toUpperCase

      public static final char[] toUpperCase(char[] chars)
      Answers the result of a char[] conversion to uppercase. 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 uppercase
      Since:
      3.5
    • 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