Class CharOperation
- Since:
- 2.1
- Restriction:
- This class is not intended to be instantiated by clients.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final char[]
Constant for all Prefixstatic final char[]
Constant for commastatic final char[]
Constant for an empty char arraystatic final char[][]
Constant for an empty char array with two dimensions.static final String[]
Constant for an empty String array. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic final char[]
append
(char[] array, char suffix) Answers a new array with appending the suffix character at the end of the array.static final char[]
append
(char[] target, char[] suffix) Answers a new array with appending the sub-array at the end of the array.static final char[]
append
(char[] target, int index, char[] array, int start, int end) Append the given sub-array to the target array starting at the given index in the target array.static final char[][]
arrayConcat
(char[][] first, char[] second) Answers a new array adding the second array at the end of first array.static final char[][]
arrayConcat
(char[][] first, char[][] second) Answers the concatenation of the two arrays.static final boolean
camelCaseMatch
(char[] pattern, char[] name) Answers true if the pattern matches the given name using CamelCase rules, or false otherwise. char[] CamelCase matching does NOT accept explicit wild-cards '*' and '?'static final boolean
camelCaseMatch
(char[] pattern, char[] name, boolean samePartCount) Answers true if the pattern matches the given name using CamelCase rules, or false otherwise. char[] CamelCase matching does NOT accept explicit wild-cards '*' and '?'static final boolean
camelCaseMatch
(char[] pattern, int patternStart, int patternEnd, char[] name, int nameStart, int nameEnd) Answers true if a sub-pattern matches the sub-part of the given name using CamelCase rules, or false otherwise.static final boolean
camelCaseMatch
(char[] pattern, int patternStart, int patternEnd, char[] name, int nameStart, int nameEnd, boolean samePartCount) Answers true if a sub-pattern matches the sub-part of the given name using CamelCase rules, or false otherwise.static String[]
charArrayToStringArray
(char[][] charArrays) Returns the char arrays as an array of Stringsstatic String
charToString
(char[] charArray) Returns the char array as a Stringstatic final int
compareTo
(char[] array1, char[] array2) Compares the two char arrays lexicographically.static final int
compareTo
(char[] array1, char[] array2, int start, int end) Compares the two char arrays lexicographically between the given start and end positions.static final int
compareWith
(char[] array, char[] prefix) Compares the contents of the two arrays array and prefix.static final char[]
concat
(char[] first, char[] second) Answers the concatenation of the two arrays.static final char[]
concat
(char[] first, char[] second, char separator) Answers the concatenation of the two arrays inserting the separator character between the two arrays.static final char[]
concat
(char[] first, char[] second, char[] third) Answers the concatenation of the three arrays.static final char[]
concat
(char[] first, char sep1, char[] second, char sep2, char[] third) Answers the concatenation of the three arrays inserting the sep1 character between the first two arrays and sep2 between the last two.static final char[]
concat
(char prefix, char[] array, char suffix) Answers a new array with prepending the prefix character and appending the suffix character at the end of the array.static final char[]
concatAll
(char[] first, char[] second, char separator) Answers the concatenation of the two arrays inserting the separator character between the two arrays.static final char[]
concatNonEmpty
(char[] first, char[] second, char separator) Answers the concatenation of the two arrays inserting the separator character between the two arrays.static final char[]
concatNonEmpty
(char[] first, char sep1, char[] second, char sep2, char[] third) Answers the concatenation of the three arrays inserting the sep1 character between the first two arrays and sep2 between the last two.static final char[]
concatWith
(char[][] array, char separator) Answers the concatenation of the given array parts using the given separator between each part.static final char[]
concatWith
(char[][] array, char[] name, char separator) Answers the concatenation of the given array parts using the given separator between each part and appending the given name at the end.static final char[]
concatWith
(char[] name, char[][] array, char separator) Answers the concatenation of the given array parts using the given separator between each part and prepending the given name at the beginning.static final char[]
concatWithAll
(char[][] array, char separator) Answers the concatenation of the given array parts using the given separator between each part irrespective of whether an element is a zero length array or not.static final boolean
contains
(char[] characters, char[] array) Answers true if the array contains an occurrence of one of the characters, false otherwise.static final boolean
contains
(char character, char[] array) Answers true if the array contains an occurrence of character, false otherwise.static final boolean
contains
(char character, char[][] array) Answers true if the array contains an occurrence of character, false otherwise.static boolean
containsEqual
(char[][] array, char[] sequence) Does the given array contain a char sequence that is equal to the give sequence?static final char[][]
deepCopy
(char[][] toCopy) Answers a deep copy of the toCopy array.static final boolean
endsWith
(char[] array, char[] toBeFound) Return true if array ends with the sequence of characters contained in toBeFound, otherwise false.static final boolean
equals
(char[][] first, char[][] second) Answers true if the two arrays are identical character by character, otherwise false.static final boolean
equals
(char[][] first, char[][] second, boolean isCaseSensitive) If isCaseSensite is true, answers true if the two arrays are identical character by character, otherwise false.static final boolean
equals
(char[] first, char[] second) Answers true if the two arrays are identical character by character, otherwise false.static final boolean
equals
(char[] first, char[] second, boolean isCaseSensitive) If isCaseSensite is true, answers true if the two arrays are identical character by character, otherwise false.static final boolean
equals
(char[] first, char[] second, int secondStart, int secondEnd) Answers true if the first array is identical character by character to a portion of the second array delimited from position secondStart (inclusive) to secondEnd(exclusive), otherwise false.static final boolean
equals
(char[] first, char[] second, int secondStart, int secondEnd, boolean isCaseSensitive) Answers true if the first array is identical character by character to a portion of the second array delimited from position secondStart (inclusive) to secondEnd(exclusive), otherwise false.static final boolean
fragmentEquals
(char[] fragment, char[] name, int startIndex, boolean isCaseSensitive) If isCaseSensite is true, the equality is case sensitive, otherwise it is case insensitive.static final int[]
getSubWordMatchingRegions
(String pattern, String name) Answers all the regions in a given name matching a subword pattern.static final int
hashCode
(char[] array) Answers a hashcode for the arraystatic final int
indexOf
(char[] toBeFound, char[] array, boolean isCaseSensitive) Answers the first index in the array for which the toBeFound array is a matching subarray following the case rule.static final int
indexOf
(char[] toBeFound, char[] array, boolean isCaseSensitive, int start) Answers the first index in the array for which the toBeFound array is a matching subarray following the case rule starting at the index start.static final int
indexOf
(char[] toBeFound, char[] array, boolean isCaseSensitive, int start, int end) Answers the first index in the array for which the toBeFound array is a matching subarray following the case rule starting at the index start.static final int
indexOf
(char toBeFound, char[] array) Answers the first index in the array for which the corresponding character is equal to toBeFound.static final int
indexOf
(char toBeFound, char[] array, int start) Answers the first index in the array for which the corresponding character is equal to toBeFound starting the search at index start.static final int
indexOf
(char toBeFound, char[] array, int start, int end) Answers the first index in the array for which the corresponding character is equal to toBeFound starting the search at index start and before the ending index.static boolean
isWhitespace
(char c) Answers true if c is a whitespace according to the JLS (\u0009, \u000a, \u000c, \u000d, \u0020), otherwise false.static final int
lastIndexOf
(char toBeFound, char[] array) Answers the last index in the array for which the corresponding character is equal to toBeFound starting from the end of the array.static final int
lastIndexOf
(char toBeFound, char[] array, int startIndex) Answers the last index in the array for which the corresponding character is equal to toBeFound stopping at the index startIndex.static final int
lastIndexOf
(char toBeFound, char[] array, int startIndex, int endIndex) Answers the last index in the array for which the corresponding character is equal to toBeFound starting from endIndex to startIndex.static final char[]
lastSegment
(char[] array, char separator) Answers the last portion of a name given a separator.static final boolean
match
(char[] pattern, char[] name, boolean isCaseSensitive) Answers true if the pattern matches the given name, false otherwise.static final boolean
match
(char[] pattern, int patternStart, int patternEnd, char[] name, int nameStart, int nameEnd, boolean isCaseSensitive) Answers true if a sub-pattern matches the subpart of the given name, false otherwise.static final int
occurencesOf
(char toBeFound, char[] array) Answers the number of occurrences of the given character in the given array, 0 if any.static final int
occurencesOf
(char toBeFound, char[] array, int start) Answers the number of occurrences of the given character in the given array starting at the given index, 0 if any.static final int
parseInt
(char[] array, int start, int length) Return the int value represented by the designated subpart of array.static final boolean
pathMatch
(char[] pattern, char[] filepath, boolean isCaseSensitive, char pathSeparator) Answers true if the pattern matches the filepath using the pathSepatator, false otherwise.static final boolean
prefixEquals
(char[] prefix, char[] name) Answers true if the given name starts with the given prefix, false otherwise.static final boolean
prefixEquals
(char[] prefix, char[] name, boolean isCaseSensitive) Answers true if the given name starts with the given prefix, false otherwise.static final boolean
prefixEquals
(char[] prefix, char[] name, boolean isCaseSensitive, int startIndex) Answers true if the given name, starting from the given index, starts with the given prefix, false otherwise. isCaseSensitive is used to find out whether or not the comparison should be case sensitive.static final char[]
prepend
(char prefix, char[] array) Answers a new array with prepending the prefix character at the start of the array.static final char[]
remove
(char[] array, char toBeRemoved) Answers a new array removing a given character.static final void
replace
(char[] array, char[] toBeReplaced, char replacementChar) Replace all occurrences of characters to be replaced with the replacement character in the given array.static final char[]
replace
(char[] array, char[] toBeReplaced, char[] replacementChars) Answers a new array of characters with substitutions.static final void
replace
(char[] array, char[] toBeReplaced, char replacementChar, int start, int end) Replace all occurrences of characters to be replaced with the replacement character in the given array from the start position (inclusive) to the end position (exclusive).static final void
replace
(char[] array, char toBeReplaced, char replacementChar) Replace all occurrence of the character to be replaced with the replacement character in the given array.static final char[]
replaceOnCopy
(char[] array, char toBeReplaced, char replacementChar) Replace all occurrence of the character to be replaced with the replacement character in a copy of the given array.static final char[][]
splitAndTrimOn
(char divider, char[] array) Return a new array which is the split of the given array using the given divider and trimming each subarray to remove whitespaces equals to ' '.static final char[][]
splitOn
(char divider, char[] array) Return a new array which is the split of the given array using the given divider.static final char[][]
splitOn
(char divider, char[] array, int start, int end) Return a new array which is the split of the given array using the given divider.static final char[][]
splitOnWithEnclosures
(char divider, char openEncl, char closeEncl, char[] array, int start, int end) Return a new array which is the split of the given array using the given divider ignoring the text between (possibly nested) openEncl and closingEncl.static final char[][]
subarray
(char[][] array, int start, int end) Answers a new array which is a copy of the given array starting at the given start and ending at the given end.static final char[]
subarray
(char[] array, int start, int end) Answers a new array which is a copy of the given array starting at the given start and ending at the given end.static final boolean
substringMatch
(char[] pattern, char[] name) Answers true if the characters of the pattern are contained in the name as a substring, in a case-insensitive way.static final boolean
substringMatch
(String pattern, String name) Answers true if the characters of the pattern are contained in the name as a substring, in a case-insensitive way.static final boolean
subWordMatch
(char[] pattern, char[] name) Answers true if the characters of the pattern are contained in the name as a subword, in a case-insensitive way.static char[][]
toCharArrays
(List<String> stringList) Converts the given list of strings to an array of equal size, containing the individual strings converted to char[] each.static final char[]
toLowerCase
(char[] chars) Answers the result of a char[] conversion to lowercase.static final String
toString
(char[][] array) Answers a string which is the concatenation of the given array using the '.' as a separator.static final String[]
toStrings
(char[][] array) Answers an array of strings from the given array of char array.static final char[]
toUpperCase
(char[] chars) Answers the result of a char[] conversion to uppercase.static final char[]
trim
(char[] chars) Answers a new array removing leading and trailing spaces (' ').
-
Field Details
-
NO_CHAR
public static final char[] NO_CHARConstant for an empty char array -
NO_CHAR_CHAR
public static final char[][] NO_CHAR_CHARConstant for an empty char array with two dimensions. -
NO_STRINGS
Constant for an empty String array.- Since:
- 3.1
-
ALL_PREFIX
public static final char[] ALL_PREFIXConstant for all Prefix- Since:
- 3.14
-
COMMA_SEPARATOR
public static final char[] COMMA_SEPARATORConstant for comma- Since:
- 3.14
-
-
Constructor Details
-
CharOperation
public CharOperation()
-
-
Method Details
-
append
public static final char[] append(char[] array, char suffix) Answers a new array with appending the suffix character at the end of the array.
For example:
array = { 'a', 'b' } suffix = 'c' => result = { 'a', 'b' , 'c' }
array = null suffix = 'c' => result = { 'c' }
- Parameters:
array
- the array that is concatenated with the suffix charactersuffix
- the suffix character- Returns:
- the new array
-
append
public static final char[] append(char[] target, char[] suffix) Answers a new array with appending the sub-array at the end of the array.
For example:
array = { 'a', 'b' } suffix = { 'c', 'd' } => result = { 'a', 'b' , 'c' , d' }
array = null suffix = { 'c' } => result = { 'c' }
- Parameters:
target
- the array that is concatenated with the suffix array.suffix
- the array that will be concatenated to the target- Returns:
- the new array
- Throws:
NullPointerException
- if the target array is null- Since:
- 3.11
-
append
public static final char[] append(char[] target, int index, char[] array, int start, int end) Append the given sub-array to the target array starting at the given index in the target array. The start of the sub-array is inclusive, the end is exclusive. Answers a new target array if it needs to grow, otherwise answers the same target array.
For example:
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)
- Parameters:
target
- the given targetindex
- the given indexarray
- the given arraystart
- the given start indexend
- the given end index- Returns:
- the new array
- Throws:
NullPointerException
- if the target array is null
-
prepend
public static final char[] prepend(char prefix, char[] array) Answers a new array with prepending the prefix character at the start of the array.
For example:
prefix = 'c' array = { 'a', 'b' } => result = { 'c' , 'a', 'b' }
prefix = 'c' array = null => result = { 'c' }
- Parameters:
array
- the array that is concatenated with the prefix characterprefix
- the prefix character- Returns:
- the new array
- Since:
- 3.14
-
arrayConcat
public static final char[][] arrayConcat(char[][] first, char[][] second) Answers the concatenation of the two arrays. It answers null if the two arrays are null. If the first array is null, then the second array is returned. If the second array is null, then the first array is returned.
For example: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' } }
- Parameters:
first
- the first array to concatenatesecond
- 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:
- 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
- Parameters:
pattern
- the given patternname
- 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:
- 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)
- Parameters:
pattern
- the given patternname
- the given namesamePartCount
- 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:
- 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 => true
- Parameters:
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- 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:
- 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)
- Parameters:
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.
For example:- 'HM' type string pattern will match 'HashMap' and 'HtmlMapper' types, but not 'HashMapEntry'
- 'HMap' type string pattern will still match previous 'HashMap' and 'HtmlMapper' types, but not 'HighMagnitude'
- Returns:
- true if a sub-pattern matches the sub-part of the given name, false otherwise
- Since:
- 3.4
-
subWordMatch
public static final boolean subWordMatch(char[] pattern, char[] name) Answers true if the characters of the pattern are contained in the name as a subword, in a case-insensitive way.- Parameters:
pattern
- the given patternname
- the given name- Returns:
- true if the pattern matches the given name, false otherwise
- Since:
- 3.21
-
getSubWordMatchingRegions
Answers all the regions in a given name matching a subword pattern.Each of these regions is made of its starting index and its length in the given name. They are all concatenated in a single array of
int
which therefore always has an even length.Note that each region is disjointed from the following one.
E.g. if the regions are{ start1, length1, start2, length2 }
, thenstart1+length1
will always be smaller thanstart2
.Examples:
pattern = "linkedmap" name = LinkedHashMap result: { 0, 6, 10, 3 }
- Parameters:
pattern
- the given patternname
- the given name- Returns:
- an array of
int
having two slots per returned regions (first one is the starting index of the region and the second one the length of the region).
Note that it may benull
if the given name does not match the pattern - Since:
- 3.21
- See Also:
-
substringMatch
Answers true if the characters of the pattern are contained in the name as a substring, in a case-insensitive way.- Parameters:
pattern
- the given patternname
- the given name- Returns:
- true if the pattern matches the given name, false otherwise
- Since:
- 3.12
-
substringMatch
public static final boolean substringMatch(char[] pattern, char[] name) Answers true if the characters of the pattern are contained in the name as a substring, in a case-insensitive way.- Parameters:
pattern
- the given patternname
- the given name- Returns:
- true if the pattern matches the given name, false otherwise
- Since:
- 3.12
-
charArrayToStringArray
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
Returns the char array as a String- Parameters:
charArray
- the char array to convert- Returns:
- the char array as a String or null if the given char array is null.
- Since:
- 3.0
-
toCharArrays
Converts the given list of strings to an array of equal size, containing the individual strings converted to char[] each.- Returns:
- an array of char[], representing the elements in the input list, or
null
if the list wasnull
. - Since:
- 3.14
-
arrayConcat
public static final char[][] arrayConcat(char[][] first, char[] second) Answers a new array adding the second array at the end of first array. It answers null if the first and second are null. If the first array is null, then a new array char[][] is created with second. If the second array is null, then the first array is returned.
For example:first = null second = { 'a' } => result = { { ' a' } }
first = { { ' a' } } second = null => result = { { ' a' } }
first = { { ' a' } } second = { ' b' } => result = { { ' a' } , { ' b' } }
- Parameters:
first
- the first array to concatenatesecond
- 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 arrayarray2
- the second given array- Returns:
- the returned value of the comparison between array1 and array2
- Throws:
NullPointerException
- if one of the arrays is null- Since:
- 3.3
-
compareTo
public static final int compareTo(char[] array1, char[] array2, int start, int end) Compares the two char arrays lexicographically between the given start and end positions. Returns a negative integer if array1 lexicographically precedes the array2, a positive integer if this array1 lexicographically follows the array2, or zero if both arrays are equal.The comparison is done between start and end positions.
- Parameters:
array1
- the first given arrayarray2
- the second given arraystart
- the starting position to compare (inclusive)end
- the ending position to compare (exclusive)- Returns:
- the returned value of the comparison between array1 and array2
- Throws:
NullPointerException
- if one of the arrays is null- Since:
- 3.7.1
-
compareWith
public static final int compareWith(char[] array, char[] prefix) Compares the contents of the two arrays array and prefix. Returns- zero if the array starts with the prefix contents
- the difference between the first two characters that are not equal
- one if array length is lower than the prefix length and that the prefix starts with the array contents.
For example:
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
- Parameters:
array
- the given arrayprefix
- 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:first = null second = { 'a' } => result = { ' a' }
first = { ' a' } second = null => result = { ' a' }
first = { ' a' } second = { ' b' } => result = { ' a' , ' b' }
- Parameters:
first
- the first array to concatenatesecond
- 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: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' }
- Parameters:
first
- the first array to concatenatesecond
- the second array to concatenatethird
- 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:first = null second = { 'a' } separator = '/' => result = { ' a' }
first = { ' a' } second = null separator = '/' => result = { ' a' }
first = { ' a' } second = { ' b' } separator = '/' => result = { ' a' , '/', 'b' }
- Parameters:
first
- the first array to concatenatesecond
- the second array to concatenateseparator
- the character to insert- Returns:
- the concatenation of the two arrays inserting the separator character between the two arrays , or null if the two arrays are null.
-
concatAll
public static final char[] concatAll(char[] first, char[] second, char separator) Answers the concatenation of the two arrays inserting the separator character between the two arrays. Differs fromcontains(char, char[])
in case second array is a zero length array. It answers null if the two arrays are null. If the first array is null, then the second array is returned. If the second array is null, then the first array is returned. if the second array is zero length array, the separator is appended.
For example:first = null second = { 'a' } separator = '/' => result = { ' a' }
first = { ' a' } second = null separator = '/' => result = { ' a' }
first = { ' a' } second = { ' b' } separator = '/' => result = { ' a' , '/', 'b' }
first = { ' a' } second = { '' } separator = '.' => result = { ' a' , '.', }
- Parameters:
first
- the first array to concatenatesecond
- the second array to concatenateseparator
- the character to insert- Returns:
- the concatenation of the two arrays inserting the separator character between the two arrays , or null if the two arrays are null. If second array is of zero length, the separator is appended to the first array and returned.
- Since:
- 3.14
-
concat
public static final char[] concat(char[] first, char sep1, char[] second, char sep2, char[] third) Answers the concatenation of the three arrays inserting the sep1 character between the first two arrays and sep2 between the last two. It answers null if the three arrays are null. If the first array is null, then it answers the concatenation of second and third inserting the sep2 character between them. If the second array is null, then it answers the concatenation of first and third inserting the sep1 character between them. If the third array is null, then it answers the concatenation of first and second inserting the sep1 character between them.
For example: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' }
- Parameters:
first
- the first array to concatenatesep1
- the character to insertsecond
- the second array to concatenatesep2
- the character to insertthird
- the second array to concatenate- Returns:
- the concatenation of the three arrays inserting the sep1 character between the two arrays and sep2 between the last two.
-
concatNonEmpty
public static final char[] concatNonEmpty(char[] first, char[] second, char separator) Answers the concatenation of the two arrays inserting the separator character between the two arrays. It answers null if the two arrays are null. If the first array is null or is empty, then the second array is returned. If the second array is null or is empty, then the first array is returned.
For example:first = null second = { 'a' } separator = '/' => result = { ' a' }
first = { ' a' } second = null separator = '/' => result = { ' a' }
first = { ' a' } second = { ' b' } separator = '/' => result = { ' a' , '/', 'b' }
first = { ' a' } second = { } separator = '/' => result = { ' a'}
- Parameters:
first
- the first array to concatenatesecond
- the second array to concatenateseparator
- the character to insert- Returns:
- the concatenation of the two arrays inserting the separator character between the two arrays , or null if the two arrays are null.
- Since:
- 3.12
-
concatNonEmpty
public static final char[] concatNonEmpty(char[] first, char sep1, char[] second, char sep2, char[] third) Answers the concatenation of the three arrays inserting the sep1 character between the first two arrays and sep2 between the last two. It answers null if the three arrays are null. If the first array is null or empty, then it answers the concatenation of second and third inserting the sep2 character between them. If the second array is null or empty, then it answers the concatenation of first and third inserting the sep1 character between them. If the third array is null or empty, then it answers the concatenation of first and second inserting the sep1 character between them.
For example: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 = { 'a' } sep1 = '/' second = { } sep2 = ':' third = { 'c' } => result = { ' a', ':', 'c' }
- Parameters:
first
- the first array to concatenatesep1
- the character to insertsecond
- the second array to concatenatesep2
- the character to insertthird
- the second array to concatenate- Returns:
- the concatenation of the three arrays inserting the sep1 character between the two arrays and sep2 between the last two.
- Since:
- 3.12
-
concat
public static final char[] concat(char prefix, char[] array, char suffix) Answers a new array with prepending the prefix character and appending the suffix character at the end of the array. If array is null, it answers a new array containing the prefix and the suffix characters.
For example:
prefix = 'a' array = { 'b' } suffix = 'c' => result = { 'a', 'b' , 'c' }
prefix = 'a' array = null suffix = 'c' => result = { 'a', 'c' }
- Parameters:
prefix
- the prefix characterarray
- the array that is concatenated with the prefix and suffix characterssuffix
- 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:
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' }
- Parameters:
name
- the given namearray
- the given arrayseparator
- 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:
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' }
- Parameters:
array
- the given arrayname
- the given nameseparator
- 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:
array = { { 'a' }, { 'b' } } separator = '.' => result = { 'a', '.', 'b' }
array = null separator = '.' => result = { }
- Parameters:
array
- the given arrayseparator
- the given separator- Returns:
- the concatenation of the given array parts using the given separator between each part
-
concatWithAll
public static final char[] concatWithAll(char[][] array, char separator) Answers the concatenation of the given array parts using the given separator between each part irrespective of whether an element is a zero length array or not.
For example:
array = { { 'a' }, {}, { 'b' } } separator = '' => result = { 'a', '/', '/', 'b' }
array = { { 'a' }, { 'b' } } separator = '.' => result = { 'a', '.', 'b' }
array = null separator = '.' => result = { }
- Parameters:
array
- the given arrayseparator
- the given separator- Returns:
- the concatenation of the given array parts using the given separator between each part
- Since:
- 3.12
-
contains
public static final boolean contains(char character, char[][] array) Answers true if the array contains an occurrence of character, false otherwise.
For example:character = 'c' array = { { ' a' }, { ' b' } } result => false
character = 'a' array = { { ' a' }, { ' b' } } result => true
- Parameters:
character
- the character to searcharray
- 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:character = 'c' array = { ' b' } result => false
character = 'a' array = { ' a' , ' b' } result => true
- Parameters:
character
- the character to searcharray
- 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:characters = { 'c', 'd' } array = { 'a', ' b' } result => false
characters = { 'c', 'd' } array = { 'a', ' b', 'c' } result => true
- Parameters:
characters
- the characters to searcharray
- the array in which the search is done- Returns:
- true if the array contains an occurrence of one of the characters, false otherwise.
- Throws:
NullPointerException
- if array is null.- Since:
- 3.1
-
containsEqual
public static boolean containsEqual(char[][] array, char[] sequence) Does the given array contain a char sequence that is equal to the give sequence?- Returns:
- true if sequence is equal to an element in array
- Since:
- 3.14
-
deepCopy
public static final char[][] deepCopy(char[][] toCopy) Answers a deep copy of the toCopy array.- Parameters:
toCopy
- the array to copy- Returns:
- a deep copy of the toCopy array.
-
endsWith
public static final boolean endsWith(char[] array, char[] toBeFound) Return true if array ends with the sequence of characters contained in toBeFound, otherwise false.
For example:array = { 'a', 'b', 'c', 'd' } toBeFound = { 'b', 'c' } result => false
array = { 'a', 'b', 'c' } toBeFound = { 'b', 'c' } result => true
- Parameters:
array
- the array to checktoBeFound
- 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:first = null second = null result => true
first = { { } } second = null result => false
first = { { 'a' } } second = { { 'a' } } result => true
first = { { 'A' } } second = { { 'a' } } result => false
- Parameters:
first
- the first arraysecond
- 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: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
- Parameters:
first
- the first arraysecond
- the second arrayisCaseSensitive
- 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:first = null second = null result => true
first = { } second = null result => false
first = { 'a' } second = { 'a' } result => true
first = { 'a' } second = { 'A' } result => false
- Parameters:
first
- the first arraysecond
- 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: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
- Parameters:
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- 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:
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
- Parameters:
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- 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: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
- Parameters:
first
- the first arraysecond
- the second arrayisCaseSensitive
- 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: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
- Parameters:
fragment
- the fragment to checkname
- the array to checkstartIndex
- the starting indexisCaseSensitive
- check whether or not the equality should be case sensitive- Returns:
- true if the name contains the fragment at the starting index startIndex according to the value of isCaseSensitive, otherwise false.
- Throws:
NullPointerException
- if fragment or name is null.
-
hashCode
public static final int hashCode(char[] array) Answers a hashcode for the array- Parameters:
array
- the array for which a hashcode is required- Returns:
- the hashcode
-
isWhitespace
public static boolean isWhitespace(char c) Answers true if c is a whitespace according to the JLS (\u0009, \u000a, \u000c, \u000d, \u0020), otherwise false.
For example:c = ' ' result => true
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:toBeFound = 'c' array = { ' a', 'b', 'c', 'd' } result => 2
toBeFound = 'e' array = { ' a', 'b', 'c', 'd' } result => -1
- Parameters:
toBeFound
- the character to searcharray
- 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:toBeFound = { 'c' } array = { ' a', 'b', 'c', 'd' } result => 2
toBeFound = { 'e' } array = { ' a', 'b', 'c', 'd' } result => -1
- Parameters:
toBeFound
- the subarray to searcharray
- the array to be searchedisCaseSensitive
- 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:toBeFound = { 'c' } array = { ' a', 'b', 'c', 'd' } result => 2
toBeFound = { 'e' } array = { ' a', 'b', 'c', 'd' } result => -1
- Parameters:
toBeFound
- the subarray to searcharray
- the array to be searchedisCaseSensitive
- flag to know if the matching should be case sensitivestart
- 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:toBeFound = { 'c' } array = { ' a', 'b', 'c', 'd' } result => 2
toBeFound = { 'e' } array = { ' a', 'b', 'c', 'd' } result => -1
- Parameters:
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)- 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: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
- Parameters:
toBeFound
- the character to searcharray
- the array to be searchedstart
- 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 nullArrayIndexOutOfBoundsException
- 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: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
- Parameters:
toBeFound
- the character to searcharray
- the array to be searchedstart
- 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 nullArrayIndexOutOfBoundsException
- 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:toBeFound = 'c' array = { ' a', 'b', 'c', 'd' , 'c', 'e' } result => 4
toBeFound = 'e' array = { ' a', 'b', 'c', 'd' } result => -1
- Parameters:
toBeFound
- the character to searcharray
- 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: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
- Parameters:
toBeFound
- the character to searcharray
- the array to be searchedstartIndex
- 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 nullArrayIndexOutOfBoundsException
- 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: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
- Parameters:
toBeFound
- the character to searcharray
- the array to be searchedstartIndex
- the stopping indexendIndex
- 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 nullArrayIndexOutOfBoundsException
- 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 arrayseparator
- 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.
For example:
If name is null, the answer is false.
If pattern is null, the answer is true if name is not null.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
- Parameters:
pattern
- the given patternname
- the given nameisCaseSensitive
- 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: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 = 4 isCaseSensitive = true result => false
- Parameters:
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- Returns:
- true if a sub-pattern matches the subpart of the given name, false otherwise
-
pathMatch
public static final boolean pathMatch(char[] pattern, char[] filepath, boolean isCaseSensitive, char pathSeparator) Answers true if the pattern matches the filepath using the pathSepatator, false otherwise. Path char[] pattern matching, accepting wild-cards '**', '*' and '?' (using Ant directory tasks conventions, also see "http://jakarta.apache.org/ant/manual/dirtasks.html#defaultexcludes"). Path pattern matching is enhancing regular pattern matching in supporting extra rule where '**' represent any folder combination. Special rule: - foo\ is equivalent to foo\** When not case sensitive, the pattern is assumed to already be lowercased, the name will be lowercased character per character as comparing.- Parameters:
pattern
- the given patternfilepath
- the given pathisCaseSensitive
- to find out whether or not the matching should be case sensitivepathSeparator
- 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:toBeFound = 'b' array = { 'a' , 'b', 'b', 'a', 'b', 'a' } result => 3
toBeFound = 'c' array = { 'a' , 'b', 'b', 'a', 'b', 'a' } result => 0
- Parameters:
toBeFound
- the given characterarray
- 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: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
- Parameters:
toBeFound
- the given characterarray
- the given arraystart
- the given index- Returns:
- the number of occurrences of the given character in the given array, 0 if any
- Throws:
NullPointerException
- if array is nullArrayIndexOutOfBoundsException
- if start is lower than 0
-
parseInt
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 parsedstart
- first character of the int value in arraylength
- 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:prefix = { 'a' , 'b' } name = { 'a' , 'b', 'b', 'a', 'b', 'a' } result => true
prefix = { 'a' , 'c' } name = { 'a' , 'b', 'b', 'a', 'b', 'a' } result => false
- Parameters:
prefix
- the given prefixname
- 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: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
- Parameters:
prefix
- the given prefixname
- the given nameisCaseSensitive
- to find out whether or not the comparison should be case sensitive- Returns:
- true if the given name starts with the given prefix, false otherwise
- Throws:
NullPointerException
- if the given name is null or if the given prefix is null
-
prefixEquals
public static final boolean prefixEquals(char[] prefix, char[] name, boolean isCaseSensitive, int startIndex) Answers true if the given name, starting from the given index, starts with the given prefix, false otherwise. isCaseSensitive is used to find out whether or not the comparison should be case sensitive.
For example:prefix = { 'a' , 'B' } name = { 'c', 'd', 'a' , 'b', 'b', 'a', 'b', 'a' } startIndex = 2 isCaseSensitive = false result => true
prefix = { 'a' , 'B' } name = { 'c', 'd', 'a' , 'b', 'b', 'a', 'b', 'a' } startIndex = 2 isCaseSensitive = true result => false
- Parameters:
prefix
- the given prefixname
- the given nameisCaseSensitive
- to find out whether or not the comparison should be case sensitivestartIndex
- index from which the prefix should be searched in the name- Returns:
- true if the given name starts with the given prefix, false otherwise
- Throws:
NullPointerException
- if the given name is null or if the given prefix is null- Since:
- 3.7
-
remove
public static final char[] remove(char[] array, char toBeRemoved) Answers a new array removing a given character. Answers the given array if there is no occurrence of the character to remove.
For example:array = { 'a' , 'b', 'b', 'c', 'b', 'a' } toBeRemoved = 'b' return { 'a' , 'c', 'a' }
array = { 'a' , 'b', 'b', 'a', 'b', 'a' } toBeRemoved = 'c' return array
- Parameters:
array
- the given arraytoBeRemoved
- 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: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' }
- Parameters:
array
- the given arraytoBeReplaced
- the character to be replacedreplacementChar
- 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: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 arraytoBeReplaced
- characters to be replacedreplacementChar
- 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: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 arraytoBeReplaced
- characters to be replacedreplacementChar
- the replacement characterstart
- 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: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' }
- Parameters:
array
- the given arraytoBeReplaced
- characters to be replacedreplacementChars
- 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: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.
- Parameters:
array
- the given arraytoBeReplaced
- the character to be replacedreplacementChar
- 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: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' } }
- Parameters:
divider
- the given dividerarray
- 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: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', ' ' } }
- Parameters:
divider
- the given dividerarray
- 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:divider = 'b' array = { 'a' , 'b', 'b', 'a', 'b', 'a' } start = 2 end = 5 result => { { }, { 'a' }, { } }
- Parameters:
divider
- the given dividerarray
- the given arraystart
- the given starting indexend
- the given ending index- Returns:
- a new array which is the split of the given array using the given divider
- Throws:
ArrayIndexOutOfBoundsException
- if start is lower than 0 or end is greater than the array length
-
splitOnWithEnclosures
public static final char[][] splitOnWithEnclosures(char divider, char openEncl, char closeEncl, char[] array, int start, int end) Return a new array which is the split of the given array using the given divider ignoring the text between (possibly nested) openEncl and closingEncl. If there are no openEncl in the code this is identical tosplitOn(char, char[], int, int)
. The given end is exclusive and the given start is inclusive.
For example:divider = ',' array = { 'A' , '<', 'B', ',', 'C', '>', ',', 'D' } start = 0 end = 8 result => { { 'A' , '<', 'B', ',', 'C', '>'}, { 'D' }}
- Parameters:
divider
- the given divideropenEncl
- the opening enclosurecloseEncl
- the closing enclosurearray
- the given arraystart
- the given starting indexend
- the given ending index- Returns:
- a new array which is the split of the given array using the given divider
- Throws:
ArrayIndexOutOfBoundsException
- if start is lower than 0 or end is greater than the array length- Since:
- 3.12
-
subarray
public static final char[][] subarray(char[][] array, int start, int end) Answers a new array which is a copy of the given array starting at the given start and ending at the given end. The given start is inclusive and the given end is exclusive. Answers null if start is greater than end, if start is lower than 0 or if end is greater than the length of the given array. If end equals -1, it is converted to the array length.
For example:array = { { 'a' } , { 'b' } } start = 0 end = 1 result => { { 'a' } }
array = { { 'a' } , { 'b' } } start = 0 end = -1 result => { { 'a' }, { 'b' } }
- Parameters:
array
- the given arraystart
- the given starting indexend
- 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:array = { 'a' , 'b' } start = 0 end = 1 result => { 'a' }
array = { 'a', 'b' } start = 0 end = -1 result => { 'a' , 'b' }
- Parameters:
array
- the given arraystart
- the given starting indexend
- 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:chars = { 'a' , 'b' } result => { 'a' , 'b' }
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:chars = { 'A' , 'B' } result => { 'A' , 'B' }
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:chars = { ' ', 'a' , 'b', ' ', ' ' } result => { 'a' , 'b' }
array = { 'A', 'b' } result => { 'A' , 'b' }
- Parameters:
chars
- the given array- Returns:
- a new array removing leading and trailing spaces (' ')
-
toString
Answers a string which is the concatenation of the given array using the '.' as a separator.
For example:array = { { 'a' } , { 'b' } } result => "a.b"
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
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
-