Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 


Eclipse JDT
Release 3.5

org.eclipse.jdt.core.compiler
Class CharOperation

java.lang.Object
  extended by 
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
static char[] NO_CHAR
          Constant for an empty char array
static char[][] NO_CHAR_CHAR
          Constant for an empty char array with two dimensions.
static  String[] NO_STRINGS
          Constant for an empty String array.
 
Constructor Summary
CharOperation ()
           
 
Method Summary
static char[] append (char[] array, char suffix)
          Answers a new array with appending the suffix character at the end of the array.
static char[] append (char[] target, int index, char[] array, int start, int end)
          Append the given sub-array to the target array starting at the given index in the target array.
static char[][] arrayConcat (char[][] first, char[] second)
          Answers a new array adding the second array at the end of first array.
static char[][] arrayConcat (char[][] first, char[][] second)
          Answers the concatenation of the two arrays.
static 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 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 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 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 int compareTo (char[] array1, char[] array2)
          Compares the two char arrays lexicographically.
static int compareWith (char[] array, char[] prefix)
          Compares the contents of the two arrays array and prefix.
static char[] concat (char[] first, char[] second)
          Answers the concatenation of the two arrays.
static char[] concat (char[] first, char[] second, char separator)
          Answers the concatenation of the two arrays inserting the separator character between the two arrays.
static char[] concat (char[] first, char[] second, char[] third)
          Answers the concatenation of the three arrays.
static char[] concat (char[] first, char sep1, char[] second, char sep2, char[] third)
          Answers the concatenation of the three arrays inserting the sep1 character between the first two arrays and sep2 between the last two.
static char[] concat (char prefix, char[] array, char suffix)
          Answers a new array with prepending the prefix character and appending the suffix character at the end of the array.
static char[] concatWith (char[][] array, char separator)
          Answers the concatenation of the given array parts using the given separator between each part.
static char[] concatWith (char[][] array, char[] name, char separator)
          Answers the concatenation of the given array parts using the given separator between each part and appending the given name at the end.
static char[] concatWith (char[] name, char[][] array, char separator)
          Answers the concatenation of the given array parts using the given separator between each part and prepending the given name at the beginning.
static boolean contains (char[] characters, char[] array)
          Answers true if the array contains an occurrence of one of the characters, false otherwise.
static boolean contains (char character, char[] array)
          Answers true if the array contains an occurrence of character, false otherwise.
static boolean contains (char character, char[][] array)
          Answers true if the array contains an occurrence of character, false otherwise.
static char[][] deepCopy (char[][] toCopy)
          Answers a deep copy of the toCopy array.
static boolean endsWith (char[] array, char[] toBeFound)
          Return true if array ends with the sequence of characters contained in toBeFound, otherwise false.
static boolean equals (char[][] first, char[][] second)
          Answers true if the two arrays are identical character by character, otherwise false.
static boolean equals (char[][] first, char[][] second, boolean isCaseSensitive)
          If isCaseSensite is true, answers true if the two arrays are identical character by character, otherwise false.
static boolean equals (char[] first, char[] second)
          Answers true if the two arrays are identical character by character, otherwise false.
static boolean equals (char[] first, char[] second, boolean isCaseSensitive)
          If isCaseSensite is true, answers true if the two arrays are identical character by character, otherwise false.
static boolean equals (char[] first, char[] second, int secondStart, int secondEnd)
          Answers true if the first array is identical character by character to a portion of the second array delimited from position secondStart (inclusive) to secondEnd(exclusive), otherwise false.
static boolean 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 boolean fragmentEquals (char[] fragment, char[] name, int startIndex, boolean isCaseSensitive)
          If isCaseSensite is true, the equality is case sensitive, otherwise it is case insensitive.
static int hashCode (char[] array)
          Answers a hashcode for the array
static int indexOf (char[] toBeFound, char[] array, boolean isCaseSensitive)
          Answers the first index in the array for which the toBeFound array is a matching subarray following the case rule.
static 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 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 int indexOf (char toBeFound, char[] array)
          Answers the first index in the array for which the corresponding character is equal to toBeFound.
static int indexOf (char toBeFound, char[] array, int start)
          Answers the first index in the array for which the corresponding character is equal to toBeFound starting the search at index start.
static 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 (\u000a, \u000c, \u000d, \u0009), otherwise false.
static int lastIndexOf (char toBeFound, char[] array)
          Answers the last index in the array for which the corresponding character is equal to toBeFound starting from the end of the array.
static int lastIndexOf (char toBeFound, char[] array, int startIndex)
          Answers the last index in the array for which the corresponding character is equal to toBeFound stopping at the index startIndex.
static int lastIndexOf (char toBeFound, char[] array, int startIndex, int endIndex)
          Answers the last index in the array for which the corresponding character is equal to toBeFound starting from endIndex to startIndex.
static char[] lastSegment (char[] array, char separator)
          Answers the last portion of a name given a separator.
static boolean match (char[] pattern, char[] name, boolean isCaseSensitive)
          Answers true if the pattern matches the given name, false otherwise.
static boolean match (char[] pattern, int patternStart, int patternEnd, char[] name, int nameStart, int nameEnd, boolean isCaseSensitive)
          Answers true if a sub-pattern matches the subpart of the given name, false otherwise.
static int occurencesOf (char toBeFound, char[] array)
          Answers the number of occurrences of the given character in the given array, 0 if any.
static int occurencesOf (char toBeFound, char[] array, int start)
          Answers the number of occurrences of the given character in the given array starting at the given index, 0 if any.
static int parseInt (char[] array, int start, int length)
          Return the int value represented by the designated subpart of array.
static boolean pathMatch (char[] pattern, char[] filepath, boolean isCaseSensitive, char pathSeparator)
          Answers true if the pattern matches the filepath using the pathSepatator, false otherwise.
static boolean prefixEquals (char[] prefix, char[] name)
          Answers true if the given name starts with the given prefix, false otherwise.
static boolean prefixEquals (char[] prefix, char[] name, boolean isCaseSensitive)
          Answers true if the given name starts with the given prefix, false otherwise.
static char[] remove (char[] array, char toBeRemoved)
          Answers a new array removing a given character.
static 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 char[] replace (char[] array, char[] toBeReplaced, char[] replacementChars)
          Answers a new array of characters with substitutions.
static void replace (char[] array, char[] toBeReplaced, char replacementChar, 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 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 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 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 char[][] splitOn (char divider, char[] array)
          Return a new array which is the split of the given array using the given divider.
static char[][] splitOn (char divider, char[] array, int start, int end)
          Return a new array which is the split of the given array using the given divider.
static char[][] subarray (char[][] array, int start, int end)
          Answers a new array which is a copy of the given array starting at the given start and ending at the given end.
static char[] subarray (char[] array, int start, int end)
          Answers a new array which is a copy of the given array starting at the given start and ending at the given end.
static char[] toLowerCase (char[] chars)
          Answers the result of a char[] conversion to lowercase.
static  String toString (char[][] array)
          Answers a string which is the concatenation of the given array using the '.' as a separator.
static  String[] toStrings (char[][] array)
          Answers an array of strings from the given array of char array.
static char[] toUpperCase (char[] chars)
          Answers the result of a char[] conversion to uppercase.
static char[] trim (char[] chars)
          Answers a new array removing leading and trailing spaces (' ').
 
Methods inherited from class java.lang. Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NO_CHAR

public static final char[] NO_CHAR
Constant for an empty char array


NO_CHAR_CHAR

public static final char[][] NO_CHAR_CHAR
Constant for an empty char array with two dimensions.


NO_STRINGS

public static final 
String[] NO_STRINGS
Constant for an empty String array.

Since:
3.1
Constructor Detail

CharOperation

public CharOperation()
Method Detail

append

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

For example:
  1.     array = { 'a', 'b' }
        suffix = 'c'
        => result = { 'a', 'b' , 'c' }
     
  2.     array = null
        suffix = 'c'
        => result = { 'c' }
     

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

append

public static final char[] append(char[] target,
                                  int index,
                                  char[] array,
                                  int start,
                                  int end)
Append the given 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

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

charArrayToStringArray

public static 
String[] charArrayToStringArray(char[][] charArrays)
Returns the char arrays as an array of Strings

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

charToString

public static 
String charToString(char[] charArray)
Returns the char array as a String

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

arrayConcat

public static final char[][] arrayConcat(char[][] first,
                                         char[] second)
Answers a new array adding the second array at the end of first array. It answers null if the first and second are null. If the first array is null, then a new array char[][] is created with second. If the second array is null, then the first array is returned.

For example:
  1.     first = null
        second = { 'a' }
        => result = { { ' a' } }
     
  2.     first = { { ' a' } }
        second = null
        => result = { { ' a' } }
     
  3.     first = { { ' a' } }
        second = { ' b' }
        => result = { { ' a' } , { ' b' } }
     

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

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

compareWith

public static final int compareWith(char[] array,
                                    char[] prefix)
Compares the contents of the two arrays array and prefix. Returns
  • zero if the array starts with the prefix contents
  • the difference between the first two characters that are not equal
  • one if array length is lower than the prefix length and that the prefix starts with the array contents.

For example:

  1.     array = null
        prefix = null
        => result = NullPointerException
     
  2.     array = { 'a', 'b', 'c', 'd', 'e' }
        prefix = { 'a', 'b', 'c'}
        => result = 0
     
  3.     array = { 'a', 'b', 'c', 'd', 'e' }
        prefix = { 'a', 'B', 'c'}
        => result = 32
     
  4.     array = { 'd', 'b', 'c', 'd', 'e' }
        prefix = { 'a', 'b', 'c'}
        => result = 3
     
  5.     array = { 'a', 'b', 'c', 'd', 'e' }
        prefix = { 'd', 'b', 'c'}
        => result = -3
     
  6.     array = { 'a', 'a', 'c', 'd', 'e' }
        prefix = { 'a', 'e', 'c'}
        => result = -4
     

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

concat

public static final char[] concat(char[] first,
                                  char[] second)
Answers the concatenation of the two arrays. It answers null if the two arrays are null. If the first array is null, then the second array is returned. If the second array is null, then the first array is returned.

For example:
  1.     first = null
        second = { 'a' }
        => result = { ' a' }
     
  2.     first = { ' a' }
        second = null
        => result = { ' a' }
     
  3.     first = { ' a' }
        second = { ' b' }
        => result = { ' a' , ' b' }
     

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

concat

public static final char[] concat(char[] first,
                                  char[] second,
                                  char[] third)
Answers the concatenation of the three arrays. It answers null if the three arrays are null. If first is null, it answers the concatenation of second and third. If second is null, it answers the concatenation of first and third. If third is null, it answers the concatenation of first and second.

For example:
  1.     first = null
        second = { 'a' }
        third = { 'b' }
        => result = { ' a', 'b' }
     
  2.     first = { 'a' }
        second = null
        third = { 'b' }
        => result = { ' a', 'b' }
     
  3.     first = { 'a' }
        second = { 'b' }
        third = null
        => result = { ' a', 'b' }
     
  4.     first = null
        second = null
        third = null
        => result = null
     
  5.     first = { 'a' }
        second = { 'b' }
        third = { 'c' }
        => result = { 'a', 'b', 'c' }
     

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

concat

public static final char[] concat(char[] first,
                                  char[] second,
                                  char separator)
Answers the concatenation of the two arrays inserting the separator character between the two arrays. It answers null if the two arrays are null. If the first array is null, then the second array is returned. If the second array is null, then the first array is returned.

For example:
  1.     first = null
        second = { 'a' }
        separator = '/'
        => result = { ' a' }
     
  2.     first = { ' a' }
        second = null
        separator = '/'
        => result = { ' a' }
     
  3.     first = { ' a' }
        second = { ' b' }
        separator = '/'
        => result = { ' a' , '/', 'b' }
     

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

concat

public static final char[] concat(char[] first,
                                  char sep1,
                                  char[] second,
                                  char sep2,
                                  char[] third)
Answers the concatenation of the three arrays inserting the sep1 character between the 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.

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

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

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
Throws:
NullPointerException - if array is null

isWhitespace

public static boolean isWhitespace(char c)
Answers true if c is a whitespace according to the JLS (\u000a, \u000c, \u000d, \u0009), otherwise false.

For example:
  1.     c = ' '
        result => true
     
  2.     c = '\u3000'
        result => false
     

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

indexOf

public static final int indexOf(char toBeFound,
                                char[] array)
Answers the first index in the array for which the corresponding character is equal to toBeFound. Answers -1 if no occurrence of this character is found.

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

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

indexOf

public static final int indexOf(char[] toBeFound,
                                char[] array,
                                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 = 2
        isCaseSensitive = true
        result => false
     

Parameters:
pattern - the given pattern
patternStart - the given pattern start
patternEnd - the given pattern end
name - the given name
nameStart - the given name start
nameEnd - the given name end
isCaseSensitive - flag to know if the matching should be case sensitive
Returns:
true if 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 "https://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

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

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

Eclipse JDT
Release 3.5

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

 
 
  Published under the terms of the Eclipse Public License Version 1.0 ("EPL") Design by Interspire