|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.jdt.core.compiler.CharOperation
public final class CharOperation
This class is a collection of helper methods to manipulate char arrays.
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 java.lang.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. |
static boolean |
camelCaseMatch(char[] pattern,
char[] name,
boolean samePartCount)
Answers true if the pattern matches the given name using CamelCase rules, or false otherwise. |
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 java.lang.String[] |
charArrayToStringArray(char[][] charArrays)
Returns the char arrays as an array of Strings |
static java.lang.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 java.lang.String |
toString(char[][] array)
Answers a string which is the concatenation of the given array using the '.' as a separator. |
static java.lang.String[] |
toStrings(char[][] array)
Answers an array of strings from the given array of char array. |
static char[] |
trim(char[] chars)
Answers a new array removing leading and trailing spaces (' '). |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final char[] NO_CHAR
public static final char[][] NO_CHAR_CHAR
public static final java.lang.String[] NO_STRINGS
Constructor Detail |
---|
public CharOperation()
Method Detail |
---|
public static final char[] append(char[] array, char suffix)
array = { 'a', 'b' } suffix = 'c' => result = { 'a', 'b' , 'c' }
array = null suffix = 'c' => result = { 'c' }
array
- the array that is concatenated with the suffix charactersuffix
- the suffix character
public static final char[] append(char[] target, int index, char[] array, int start, int end)
target = { 'a', 'b', '0' } index = 2 array = { 'c', 'd' } start = 0 end = 1 => result = { 'a', 'b' , 'c' }
target = { 'a', 'b' } index = 2 array = { 'c', 'd' } start = 0 end = 1 => result = { 'a', 'b' , 'c', '0', '0' , '0' } (new array)
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)
target
- the given targetindex
- the given indexarray
- the given arraystart
- the given start indexend
- the given end index
java.lang.NullPointerException
- if the target array is nullpublic static final char[][] arrayConcat(char[][] first, char[][] second)
first = null second = null => result = null
first = { { ' a' } } second = null => result = { { ' a' } }
first = null second = { { ' a' } } => result = { { ' a' } }
first = { { ' b' } } second = { { ' a' } } => result = { { ' b' }, { ' a' } }
first
- the first array to concatenatesecond
- the second array to concatenate
public static final boolean camelCaseMatch(char[] pattern, char[] name)
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:
- pattern = "NPE".toCharArray() name = "NullPointerException".toCharArray() result => true
- pattern = "NPE".toCharArray() name = "NoPermissionException".toCharArray() result => true
- pattern = "NuPoEx".toCharArray() name = "NullPointerException".toCharArray() result => true
- pattern = "NuPoEx".toCharArray() name = "NoPermissionException".toCharArray() result => false
- pattern = "npe".toCharArray() name = "NullPointerException".toCharArray() result => false
- pattern = "IPL3".toCharArray() name = "IPerspectiveListener3".toCharArray() result => true
- pattern = "HM".toCharArray() name = "HashMapEntry".toCharArray() result => true
pattern
- the given patternname
- the given name
public static final boolean camelCaseMatch(char[] pattern, char[] name, boolean samePartCount)
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:
- pattern = "NPE".toCharArray() name = "NullPointerException".toCharArray() result => true
- pattern = "NPE".toCharArray() name = "NoPermissionException".toCharArray() result => true
- pattern = "NuPoEx".toCharArray() name = "NullPointerException".toCharArray() result => true
- pattern = "NuPoEx".toCharArray() name = "NoPermissionException".toCharArray() result => false
- pattern = "npe".toCharArray() name = "NullPointerException".toCharArray() result => false
- pattern = "IPL3".toCharArray() name = "IPerspectiveListener3".toCharArray() result => true
- pattern = "HM".toCharArray() name = "HashMapEntry".toCharArray() result => (samePartCount == false)
pattern
- the given patternname
- the given namesamePartCount
- flag telling whether the pattern and the name should
have the same count of parts or not.public static final boolean camelCaseMatch(char[] pattern, int patternStart, int patternEnd, char[] name, int nameStart, int nameEnd)
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:
pattern
- the given patternpatternStart
- the start index of the pattern, inclusivepatternEnd
- the end index of the pattern, exclusivename
- the given namenameStart
- the start index of the name, inclusivenameEnd
- the end index of the name, exclusive
public static final boolean camelCaseMatch(char[] pattern, int patternStart, int patternEnd, char[] name, int nameStart, int nameEnd, boolean samePartCount)
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:
- pattern = "NPE".toCharArray() patternStart = 0 patternEnd = 3 name = "NullPointerException".toCharArray() nameStart = 0 nameEnd = 20 result => true
- pattern = "NPE".toCharArray() patternStart = 0 patternEnd = 3 name = "NoPermissionException".toCharArray() nameStart = 0 nameEnd = 21 result => true
- pattern = "NuPoEx".toCharArray() patternStart = 0 patternEnd = 6 name = "NullPointerException".toCharArray() nameStart = 0 nameEnd = 20 result => true
- pattern = "NuPoEx".toCharArray() patternStart = 0 patternEnd = 6 name = "NoPermissionException".toCharArray() nameStart = 0 nameEnd = 21 result => false
- pattern = "npe".toCharArray() patternStart = 0 patternEnd = 3 name = "NullPointerException".toCharArray() nameStart = 0 nameEnd = 20 result => false
- pattern = "IPL3".toCharArray() patternStart = 0 patternEnd = 4 name = "IPerspectiveListener3".toCharArray() nameStart = 0 nameEnd = 21 result => true
- pattern = "HM".toCharArray() patternStart = 0 patternEnd = 2 name = "HashMapEntry".toCharArray() nameStart = 0 nameEnd = 12 result => (samePartCount == false)
pattern
- the given patternpatternStart
- the start index of the pattern, inclusivepatternEnd
- the end index of the pattern, exclusivename
- the given namenameStart
- the start index of the name, inclusivenameEnd
- the end index of the name, exclusivesamePartCount
- flag telling whether the pattern and the name should
have the same count of parts or not.public static java.lang.String[] charArrayToStringArray(char[][] charArrays)
charArrays
- the char array to convert
public static java.lang.String charToString(char[] charArray)
charArray
- the char array to convert
public static final char[][] arrayConcat(char[][] first, char[] second)
first = null second = { 'a' } => result = { { ' a' } }
first = { { ' a' } } second = null => result = { { ' a' } }
first = { { ' a' } } second = { ' b' } => result = { { ' a' } , { ' b' } }
first
- the first array to concatenatesecond
- the array to add at the end of the first array
public static final int compareTo(char[] array1, char[] array2)
array1
- the first given arrayarray2
- the second given array
java.lang.NullPointerException
- if one of the arrays is nullpublic static final int compareWith(char[] array, char[] prefix)
For example:
array = null prefix = null => result = NullPointerException
array = { 'a', 'b', 'c', 'd', 'e' } prefix = { 'a', 'b', 'c'} => result = 0
array = { 'a', 'b', 'c', 'd', 'e' } prefix = { 'a', 'B', 'c'} => result = 32
array = { 'd', 'b', 'c', 'd', 'e' } prefix = { 'a', 'b', 'c'} => result = 3
array = { 'a', 'b', 'c', 'd', 'e' } prefix = { 'd', 'b', 'c'} => result = -3
array = { 'a', 'a', 'c', 'd', 'e' } prefix = { 'a', 'e', 'c'} => result = -4
array
- the given arrayprefix
- the given prefix
java.lang.NullPointerException
- if either array or prefix is nullpublic static final char[] concat(char[] first, char[] second)
first = null second = { 'a' } => result = { ' a' }
first = { ' a' } second = null => result = { ' a' }
first = { ' a' } second = { ' b' } => result = { ' a' , ' b' }
first
- the first array to concatenatesecond
- the second array to concatenate
public static final char[] concat(char[] first, char[] second, char[] third)
first = null second = { 'a' } third = { 'b' } => result = { ' a', 'b' }
first = { 'a' } second = null third = { 'b' } => result = { ' a', 'b' }
first = { 'a' } second = { 'b' } third = null => result = { ' a', 'b' }
first = null second = null third = null => result = null
first = { 'a' } second = { 'b' } third = { 'c' } => result = { 'a', 'b', 'c' }
first
- the first array to concatenatesecond
- the second array to concatenatethird
- the third array to concatenate
public static final char[] concat(char[] first, char[] second, char separator)
first = null second = { 'a' } separator = '/' => result = { ' a' }
first = { ' a' } second = null separator = '/' => result = { ' a' }
first = { ' a' } second = { ' b' } separator = '/' => result = { ' a' , '/', 'b' }
first
- the first array to concatenatesecond
- the second array to concatenateseparator
- the character to insert
public static final char[] concat(char[] first, char sep1, char[] second, char sep2, char[] third)
first = null sep1 = '/' second = { 'a' } sep2 = ':' third = { 'b' } => result = { ' a' , ':', 'b' }
first = { 'a' } sep1 = '/' second = null sep2 = ':' third = { 'b' } => result = { ' a' , '/', 'b' }
first = { 'a' } sep1 = '/' second = { 'b' } sep2 = ':' third = null => result = { ' a' , '/', 'b' }
first = { 'a' } sep1 = '/' second = { 'b' } sep2 = ':' third = { 'c' } => result = { ' a' , '/', 'b' , ':', 'c' }
first
- the first array to concatenatesep1
- the character to insertsecond
- the second array to concatenatesep2
- the character to insertthird
- the second array to concatenate
public static final char[] concat(char prefix, char[] array, char suffix)
prefix = 'a' array = { 'b' } suffix = 'c' => result = { 'a', 'b' , 'c' }
prefix = 'a' array = null suffix = 'c' => result = { 'a', 'c' }
prefix
- the prefix characterarray
- the array that is concatenated with the prefix and suffix characterssuffix
- the suffix character
public static final char[] concatWith(char[] name, char[][] array, char separator)
name = { 'c' } array = { { 'a' }, { 'b' } } separator = '.' => result = { 'a', '.', 'b' , '.', 'c' }
name = null array = { { 'a' }, { 'b' } } separator = '.' => result = { 'a', '.', 'b' }
name = { ' c' } array = null separator = '.' => result = { 'c' }
name
- the given namearray
- the given arrayseparator
- the given separator
public static final char[] concatWith(char[][] array, char[] name, char separator)
name = { 'c' } array = { { 'a' }, { 'b' } } separator = '.' => result = { 'a', '.', 'b' , '.', 'c' }
name = null array = { { 'a' }, { 'b' } } separator = '.' => result = { 'a', '.', 'b' }
name = { ' c' } array = null separator = '.' => result = { 'c' }
array
- the given arrayname
- the given nameseparator
- the given separator
public static final char[] concatWith(char[][] array, char separator)
array = { { 'a' }, { 'b' } } separator = '.' => result = { 'a', '.', 'b' }
array = null separator = '.' => result = { }
array
- the given arrayseparator
- the given separator
public static final boolean contains(char character, char[][] array)
character = 'c' array = { { ' a' }, { ' b' } } result => false
character = 'a' array = { { ' a' }, { ' b' } } result => true
character
- the character to searcharray
- the array in which the search is done
java.lang.NullPointerException
- if array is null.public static final boolean contains(char character, char[] array)
character = 'c' array = { ' b' } result => false
character = 'a' array = { ' a' , ' b' } result => true
character
- the character to searcharray
- the array in which the search is done
java.lang.NullPointerException
- if array is null.public static final boolean contains(char[] characters, char[] array)
characters = { 'c', 'd' } array = { 'a', ' b' } result => false
characters = { 'c', 'd' } array = { 'a', ' b', 'c' } result => true
characters
- the characters to searcharray
- the array in which the search is done
java.lang.NullPointerException
- if array is null.public static final char[][] deepCopy(char[][] toCopy)
toCopy
- the array to copy
public static final boolean endsWith(char[] array, char[] toBeFound)
array = { 'a', 'b', 'c', 'd' } toBeFound = { 'b', 'c' } result => false
array = { 'a', 'b', 'c' } toBeFound = { 'b', 'c' } result => true
array
- the array to checktoBeFound
- the array to find
java.lang.NullPointerException
- if array is null or toBeFound is nullpublic static final boolean equals(char[][] first, char[][] second)
first = null second = null result => true
first = { { } } second = null result => false
first = { { 'a' } } second = { { 'a' } } result => true
first = { { 'A' } } second = { { 'a' } } result => false
first
- the first arraysecond
- the second array
public static final boolean equals(char[][] first, char[][] second, boolean isCaseSensitive)
first = null second = null isCaseSensitive = true result => true
first = { { } } second = null isCaseSensitive = true result => false
first = { { 'A' } } second = { { 'a' } } isCaseSensitive = true result => false
first = { { 'A' } } second = { { 'a' } } isCaseSensitive = false result => true
first
- the first arraysecond
- the second arrayisCaseSensitive
- check whether or not the equality should be case sensitive
public static final boolean equals(char[] first, char[] second)
first = null second = null result => true
first = { } second = null result => false
first = { 'a' } second = { 'a' } result => true
first = { 'a' } second = { 'A' } result => false
first
- the first arraysecond
- the second array
public static final boolean equals(char[] first, char[] second, int secondStart, int secondEnd)
first = null second = null secondStart = 0 secondEnd = 0 result => true
first = { } second = null secondStart = 0 secondEnd = 0 result => false
first = { 'a' } second = { 'a' } secondStart = 0 secondEnd = 1 result => true
first = { 'a' } second = { 'A' } secondStart = 0 secondEnd = 1 result => false
first
- the first arraysecond
- the second arraysecondStart
- inclusive start position in the second array to comparesecondEnd
- exclusive end position in the second array to compare
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:
first = null second = null secondStart = 0 secondEnd = 0 isCaseSensitive = false result => true
first = { } second = null secondStart = 0 secondEnd = 0 isCaseSensitive = false result => false
first = { 'a' } second = { 'a' } secondStart = 0 secondEnd = 1 isCaseSensitive = true result => true
first = { 'a' } second = { 'A' } secondStart = 0 secondEnd = 1 isCaseSensitive = true result => false
first = { 'a' } second = { 'A' } secondStart = 0 secondEnd = 1 isCaseSensitive = false result => true
first
- the first arraysecond
- the second arraysecondStart
- inclusive start position in the second array to comparesecondEnd
- exclusive end position in the second array to compareisCaseSensitive
- check whether or not the equality should be case sensitive
public static final boolean equals(char[] first, char[] second, boolean isCaseSensitive)
first = null second = null isCaseSensitive = true result => true
first = { } second = null isCaseSensitive = true result => false
first = { 'A' } second = { 'a' } isCaseSensitive = true result => false
first = { 'A' } second = { 'a' } isCaseSensitive = false result => true
first
- the first arraysecond
- the second arrayisCaseSensitive
- check whether or not the equality should be case sensitive
public static final boolean fragmentEquals(char[] fragment, char[] name, int startIndex, boolean isCaseSensitive)
fragment = { 'b', 'c' , 'd' } name = { 'a', 'b', 'c' , 'd' } startIndex = 1 isCaseSensitive = true result => true
fragment = { 'b', 'c' , 'd' } name = { 'a', 'b', 'C' , 'd' } startIndex = 1 isCaseSensitive = true result => false
fragment = { 'b', 'c' , 'd' } name = { 'a', 'b', 'C' , 'd' } startIndex = 0 isCaseSensitive = false result => false
fragment = { 'b', 'c' , 'd' } name = { 'a', 'b'} startIndex = 0 isCaseSensitive = true result => false
fragment
- the fragment to checkname
- the array to checkstartIndex
- the starting indexisCaseSensitive
- check whether or not the equality should be case sensitive
java.lang.NullPointerException
- if fragment or name is null.public static final int hashCode(char[] array)
array
- the array for which a hashcode is required
java.lang.NullPointerException
- if array is nullpublic static boolean isWhitespace(char c)
c = ' ' result => true
c = '\u3000' result => false
c
- the character to check
public static final int indexOf(char toBeFound, char[] array)
toBeFound = 'c' array = { ' a', 'b', 'c', 'd' } result => 2
toBeFound = 'e' array = { ' a', 'b', 'c', 'd' } result => -1
toBeFound
- the character to searcharray
- the array to be searched
java.lang.NullPointerException
- if array is nullpublic static final int indexOf(char[] toBeFound, char[] array, boolean isCaseSensitive)
toBeFound = { 'c' } array = { ' a', 'b', 'c', 'd' } result => 2
toBeFound = { 'e' } array = { ' a', 'b', 'c', 'd' } result => -1
toBeFound
- the subarray to searcharray
- the array to be searchedisCaseSensitive
- flag to know if the matching should be case sensitive
java.lang.NullPointerException
- if array is null or toBeFound is nullpublic static final int indexOf(char[] toBeFound, char[] array, boolean isCaseSensitive, int start)
toBeFound = { 'c' } array = { ' a', 'b', 'c', 'd' } result => 2
toBeFound = { 'e' } array = { ' a', 'b', 'c', 'd' } result => -1
toBeFound
- the subarray to searcharray
- the array to be searchedisCaseSensitive
- flag to know if the matching should be case sensitivestart
- the starting index
java.lang.NullPointerException
- if array is null or toBeFound is nullpublic static final int indexOf(char[] toBeFound, char[] array, boolean isCaseSensitive, int start, int end)
toBeFound = { 'c' } array = { ' a', 'b', 'c', 'd' } result => 2
toBeFound = { 'e' } array = { ' a', 'b', 'c', 'd' } result => -1
toBeFound
- the subarray to searcharray
- the array to be searchedisCaseSensitive
- flag to know if the matching should be case sensitivestart
- the starting index (inclusive)end
- the end index (exclusive)
java.lang.NullPointerException
- if array is null or toBeFound is nullpublic static final int indexOf(char toBeFound, char[] array, int start)
toBeFound = 'c' array = { ' a', 'b', 'c', 'd' } start = 2 result => 2
toBeFound = 'c' array = { ' a', 'b', 'c', 'd' } start = 3 result => -1
toBeFound = 'e' array = { ' a', 'b', 'c', 'd' } start = 1 result => -1
toBeFound
- the character to searcharray
- the array to be searchedstart
- the starting index
java.lang.NullPointerException
- if array is null
java.lang.ArrayIndexOutOfBoundsException
- if start is lower than 0public static final int indexOf(char toBeFound, char[] array, int start, int end)
toBeFound = 'c' array = { ' a', 'b', 'c', 'd' } start = 2 result => 2
toBeFound = 'c' array = { ' a', 'b', 'c', 'd' } start = 3 result => -1
toBeFound = 'e' array = { ' a', 'b', 'c', 'd' } start = 1 result => -1
toBeFound
- the character to searcharray
- the array to be searchedstart
- the starting index (inclusive)end
- the ending index (exclusive)
java.lang.NullPointerException
- if array is null
java.lang.ArrayIndexOutOfBoundsException
- if start is lower than 0 or ending greater than array lengthpublic static final int lastIndexOf(char toBeFound, char[] array)
toBeFound = 'c' array = { ' a', 'b', 'c', 'd' , 'c', 'e' } result => 4
toBeFound = 'e' array = { ' a', 'b', 'c', 'd' } result => -1
toBeFound
- the character to searcharray
- the array to be searched
java.lang.NullPointerException
- if array is nullpublic static final int lastIndexOf(char toBeFound, char[] array, int startIndex)
toBeFound = 'c' array = { ' a', 'b', 'c', 'd' } startIndex = 2 result => 2
toBeFound = 'c' array = { ' a', 'b', 'c', 'd', 'e' } startIndex = 3 result => -1
toBeFound = 'e' array = { ' a', 'b', 'c', 'd' } startIndex = 0 result => -1
toBeFound
- the character to searcharray
- the array to be searchedstartIndex
- the stopping index
java.lang.NullPointerException
- if array is null
java.lang.ArrayIndexOutOfBoundsException
- if startIndex is lower than 0public static final int lastIndexOf(char toBeFound, char[] array, int startIndex, int endIndex)
toBeFound = 'c' array = { ' a', 'b', 'c', 'd' } startIndex = 2 endIndex = 2 result => 2
toBeFound = 'c' array = { ' a', 'b', 'c', 'd', 'e' } startIndex = 3 endIndex = 4 result => -1
toBeFound = 'e' array = { ' a', 'b', 'c', 'd' } startIndex = 0 endIndex = 3 result => -1
toBeFound
- the character to searcharray
- the array to be searchedstartIndex
- the stopping indexendIndex
- the starting index
java.lang.NullPointerException
- if array is null
java.lang.ArrayIndexOutOfBoundsException
- if endIndex is greater or equals to array length or starting is lower than 0public static final char[] lastSegment(char[] array, char separator)
lastSegment("java.lang.Object".toCharArray(),'.') --> Object
array
- the arrayseparator
- the given separator
java.lang.NullPointerException
- if array is nullpublic static final boolean match(char[] pattern, char[] name, boolean isCaseSensitive)
pattern = { '?', 'b', '*' } name = { 'a', 'b', 'c' , 'd' } isCaseSensitive = true result => true
pattern = { '?', 'b', '?' } name = { 'a', 'b', 'c' , 'd' } isCaseSensitive = true result => false
pattern = { 'b', '*' } name = { 'a', 'b', 'c' , 'd' } isCaseSensitive = true result => false
pattern
- the given patternname
- the given nameisCaseSensitive
- flag to know whether or not the matching should be case sensitive
public static final boolean match(char[] pattern, int patternStart, int patternEnd, char[] name, int nameStart, int nameEnd, boolean isCaseSensitive)
pattern = { '?', 'b', '*' } patternStart = 1 patternEnd = 3 name = { 'a', 'b', 'c' , 'd' } nameStart = 1 nameEnd = 4 isCaseSensitive = true result => true
pattern = { '?', 'b', '*' } patternStart = 1 patternEnd = 2 name = { 'a', 'b', 'c' , 'd' } nameStart = 1 nameEnd = 2 isCaseSensitive = true result => false
pattern
- the given patternpatternStart
- the given pattern startpatternEnd
- the given pattern endname
- the given namenameStart
- the given name startnameEnd
- the given name endisCaseSensitive
- flag to know if the matching should be case sensitive
public static final boolean pathMatch(char[] pattern, char[] filepath, boolean isCaseSensitive, char pathSeparator)
pattern
- the given patternfilepath
- the given pathisCaseSensitive
- to find out whether or not the matching should be case sensitivepathSeparator
- the given path separator
public static final int occurencesOf(char toBeFound, char[] array)
toBeFound = 'b' array = { 'a' , 'b', 'b', 'a', 'b', 'a' } result => 3
toBeFound = 'c' array = { 'a' , 'b', 'b', 'a', 'b', 'a' } result => 0
toBeFound
- the given characterarray
- the given array
java.lang.NullPointerException
- if array is nullpublic static final int occurencesOf(char toBeFound, char[] array, int start)
toBeFound = 'b' array = { 'a' , 'b', 'b', 'a', 'b', 'a' } start = 2 result => 2
toBeFound = 'c' array = { 'a' , 'b', 'b', 'a', 'b', 'a' } start = 0 result => 0
toBeFound
- the given characterarray
- the given arraystart
- the given index
java.lang.NullPointerException
- if array is null
java.lang.ArrayIndexOutOfBoundsException
- if start is lower than 0public static final int parseInt(char[] array, int start, int length) throws java.lang.NumberFormatException
array
- the array within which the int value is to be parsedstart
- first character of the int value in arraylength
- length of the int value in array
java.lang.NumberFormatException
- if the designated subpart of array does not
parse to an intpublic static final boolean prefixEquals(char[] prefix, char[] name)
prefix = { 'a' , 'b' } name = { 'a' , 'b', 'b', 'a', 'b', 'a' } result => true
prefix = { 'a' , 'c' } name = { 'a' , 'b', 'b', 'a', 'b', 'a' } result => false
prefix
- the given prefixname
- the given name
java.lang.NullPointerException
- if the given name is null or if the given prefix is nullpublic static final boolean prefixEquals(char[] prefix, char[] name, boolean isCaseSensitive)
prefix = { 'a' , 'B' } name = { 'a' , 'b', 'b', 'a', 'b', 'a' } isCaseSensitive = false result => true
prefix = { 'a' , 'B' } name = { 'a' , 'b', 'b', 'a', 'b', 'a' } isCaseSensitive = true result => false
prefix
- the given prefixname
- the given nameisCaseSensitive
- to find out whether or not the comparison should be case sensitive
java.lang.NullPointerException
- if the given name is null or if the given prefix is nullpublic static final char[] remove(char[] array, char toBeRemoved)
array = { 'a' , 'b', 'b', 'c', 'b', 'a' } toBeRemoved = 'b' return { 'a' , 'c', 'a' }
array = { 'a' , 'b', 'b', 'a', 'b', 'a' } toBeRemoved = 'c' return array
array
- the given arraytoBeRemoved
- the character to be removed
public static final void replace(char[] array, char toBeReplaced, char replacementChar)
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' }
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' }
array
- the given arraytoBeReplaced
- the character to be replacedreplacementChar
- the replacement character
java.lang.NullPointerException
- if the given array is nullpublic static final void replace(char[] array, char[] toBeReplaced, char replacementChar)
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' }
array
- the given arraytoBeReplaced
- characters to be replacedreplacementChar
- the replacement character
java.lang.NullPointerException
- if arrays are null.public static final void replace(char[] array, char[] toBeReplaced, char replacementChar, int start, int end)
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' }
array
- the given arraytoBeReplaced
- characters to be replacedreplacementChar
- the replacement characterstart
- the given start position (inclusive)end
- the given end position (exclusive)
java.lang.NullPointerException
- if arrays are null.public static final char[] replace(char[] array, char[] toBeReplaced, char[] replacementChars)
array = { 'a' , 'b', 'b', 'a', 'b', 'a' } toBeReplaced = { 'b' } replacementChar = { 'a', 'a' } result => { 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a' }
array = { 'a' , 'b', 'b', 'a', 'b', 'a' } toBeReplaced = { 'c' } replacementChar = { 'a' } result => { 'a' , 'b', 'b', 'a', 'b', 'a' }
array
- the given arraytoBeReplaced
- characters to be replacedreplacementChars
- the replacement characters
java.lang.NullPointerException
- if the given array is nullpublic static final char[] replaceOnCopy(char[] array, char toBeReplaced, char replacementChar)
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' }
array = { 'a' , 'b', 'b', 'a', 'b', 'a' } toBeReplaced = 'c' replacementChar = 'a' result => The original array that remains unchanged.
array
- the given arraytoBeReplaced
- the character to be replacedreplacementChar
- the replacement character
java.lang.NullPointerException
- if the given array is nullpublic static final char[][] splitAndTrimOn(char divider, char[] array)
divider = 'b' array = { 'a' , 'b', 'b', 'a', 'b', 'a' } result => { { 'a' }, { }, { 'a' }, { 'a' } }
divider = 'c' array = { 'a' , 'b', 'b', 'a', 'b', 'a' } result => { { 'a', 'b', 'b', 'a', 'b', 'a' } }
divider = 'b' array = { 'a' , ' ', 'b', 'b', 'a', 'b', 'a' } result => { { 'a' }, { }, { 'a' }, { 'a' } }
divider = 'c' array = { ' ', ' ', 'a' , 'b', 'b', 'a', 'b', 'a', ' ' } result => { { 'a', 'b', 'b', 'a', 'b', 'a' } }
divider
- the given dividerarray
- the given array
public static final char[][] splitOn(char divider, char[] array)
divider = 'b' array = { 'a' , 'b', 'b', 'a', 'b', 'a' } result => { { 'a' }, { }, { 'a' }, { 'a' } }
divider = 'c' array = { 'a' , 'b', 'b', 'a', 'b', 'a' } result => { { 'a', 'b', 'b', 'a', 'b', 'a' } }
divider = 'c' array = { ' ', ' ', 'a' , 'b', 'b', 'a', 'b', 'a', ' ' } result => { { ' ', 'a', 'b', 'b', 'a', 'b', 'a', ' ' } }
divider
- the given dividerarray
- the given array
public static final char[][] splitOn(char divider, char[] array, int start, int end)
divider = 'b' array = { 'a' , 'b', 'b', 'a', 'b', 'a' } start = 2 end = 5 result => { { }, { 'a' }, { } }
divider
- the given dividerarray
- the given arraystart
- the given starting indexend
- the given ending index
java.lang.ArrayIndexOutOfBoundsException
- if start is lower than 0 or end is greater than the array lengthpublic static final char[][] subarray(char[][] array, int start, int end)
array = { { 'a' } , { 'b' } } start = 0 end = 1 result => { { 'a' } }
array = { { 'a' } , { 'b' } } start = 0 end = -1 result => { { 'a' }, { 'b' } }
array
- the given arraystart
- the given starting indexend
- the given ending index
java.lang.NullPointerException
- if the given array is nullpublic static final char[] subarray(char[] array, int start, int end)
array = { 'a' , 'b' } start = 0 end = 1 result => { 'a' }
array = { 'a', 'b' } start = 0 end = -1 result => { 'a' , 'b' }
array
- the given arraystart
- the given starting indexend
- the given ending index
java.lang.NullPointerException
- if the given array is nullpublic static final char[] toLowerCase(char[] chars)
chars = { 'a' , 'b' } result => { 'a' , 'b' }
array = { 'A', 'b' } result => { 'a' , 'b' }
chars
- the chars to convert
public static final char[] trim(char[] chars)
chars = { ' ', 'a' , 'b', ' ', ' ' } result => { 'a' , 'b' }
array = { 'A', 'b' } result => { 'A' , 'b' }
chars
- the given array
public static final java.lang.String toString(char[][] array)
array = { { 'a' } , { 'b' } } result => "a.b"
array = { { ' ', 'a' } , { 'b' } } result => " a.b"
array
- the given array
public static final java.lang.String[] toStrings(char[][] array)
array
- the given array
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |