|
Eclipse JDT Release 3.0 |
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.eclipse.jdt.core.compiler.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. |
| Constructor Summary | |
CharOperation()
|
|
| Method Summary | |
static char[] |
append(char[] array,
char suffix)
Answers a new array with appending the suffix character at the end of the array. |
static char[] |
append(char[] target,
int index,
char[] array,
int start,
int end)
Append the given subarray to the target array starting at the given index in the target array. |
static char[][] |
arrayConcat(char[][] first,
char[] second)
Answers a new array adding the second array at the end of first array. |
static char[][] |
arrayConcat(char[][] first,
char[][] second)
Answers the concatenation of the two arrays. |
static String[] |
charArrayToStringArray(char[][] charArrays)
Returns the char arrays as an array of Strings |
static String |
charToString(char[] charArray)
Returns the char array as a String |
static int |
compareWith(char[] array,
char[] prefix)
Compares the contents of the two arrays array and prefix. |
static char[] |
concat(char[] first,
char[] second)
Answers the concatenation of the two arrays. |
static char[] |
concat(char[] first,
char[] second,
char separator)
Answers the concatenation of the two arrays inserting the separator character between the two arrays. |
static char[] |
concat(char[] first,
char[] second,
char[] third)
Answers the concatenation of the three arrays. |
static char[] |
concat(char[] first,
char sep1,
char[] second,
char sep2,
char[] third)
Answers the concatenation of the three arrays inserting the sep1 character between the two arrays and sep2 between the last two. |
static char[] |
concat(char prefix,
char[] array,
char suffix)
Answers a new array with prepending the prefix character and appending the suffix character at the end of the array. |
static char[] |
concatWith(char[][] array,
char separator)
Answers the concatenation of the given array parts using the given separator between each part. |
static char[] |
concatWith(char[][] array,
char[] name,
char separator)
Answers the concatenation of the given array parts using the given separator between each part and appending the given name at the end. |
static char[] |
concatWith(char[] name,
char[][] array,
char separator)
Answers the concatenation of the given array parts using the given separator between each part and appending the given name at the end. |
static boolean |
contains(char character,
char[] array)
Answers true if the array contains an occurrence of character, false otherwise. |
static boolean |
contains(char character,
char[][] array)
Answers true if the array contains an occurrence of character, false otherwise. |
static char[][] |
deepCopy(char[][] toCopy)
Answers a deep copy of the toCopy array. |
static boolean |
endsWith(char[] array,
char[] toBeFound)
Return true if array ends with the sequence of characters contained in toBeFound, otherwise false. |
static boolean |
equals(char[][] first,
char[][] second)
Answers true if the two arrays are identical character by character, otherwise false. |
static boolean |
equals(char[][] first,
char[][] second,
boolean isCaseSensitive)
If isCaseSensite is true, answers true if the two arrays are identical character by character, otherwise false. |
static boolean |
equals(char[] first,
char[] second)
Answers true if the two arrays are identical character by character, otherwise false. |
static boolean |
equals(char[] first,
char[] second,
boolean isCaseSensitive)
If isCaseSensite is true, answers true if the two arrays are identical character by character, otherwise false. |
static boolean |
equals(char[] first,
char[] second,
int secondStart,
int secondEnd)
Answers true if the first array is identical character by character to a portion of the second array delimited from position secondStart (inclusive) to secondEnd(exclusive), otherwise false. |
static boolean |
fragmentEquals(char[] fragment,
char[] name,
int startIndex,
boolean isCaseSensitive)
If isCaseSensite is true, the equality is case sensitive, otherwise it is case insensitive. |
static int |
hashCode(char[] array)
Answers a hashcode for the array |
static int |
indexOf(char toBeFound,
char[] array)
Answers the first index in the array for which the corresponding character is equal to toBeFound. |
static int |
indexOf(char toBeFound,
char[] array,
int start)
Answers the first index in the array for which the corresponding character is equal to toBeFound starting the search at index start. |
static boolean |
isWhitespace(char c)
Answers true if c is a whitespace according to the JLS (\u000a, \u000c, \u000d, \u0009), otherwise false. |
static int |
lastIndexOf(char toBeFound,
char[] array)
Answers the last index in the array for which the corresponding character is equal to toBeFound starting from the end of the array. |
static int |
lastIndexOf(char toBeFound,
char[] array,
int startIndex)
Answers the last index in the array for which the corresponding character is equal to toBeFound stopping at the index startIndex. |
static int |
lastIndexOf(char toBeFound,
char[] array,
int startIndex,
int endIndex)
Answers the last index in the array for which the corresponding character is equal to toBeFound starting from endIndex to startIndex. |
static char[] |
lastSegment(char[] array,
char separator)
Answers the last portion of a name given a separator. |
static boolean |
match(char[] pattern,
char[] name,
boolean isCaseSensitive)
Answers true if the pattern matches the given name, false otherwise. |
static boolean |
match(char[] pattern,
int patternStart,
int patternEnd,
char[] name,
int nameStart,
int nameEnd,
boolean isCaseSensitive)
Answers true if the a sub-pattern matches the subpart of the given name, false otherwise. |
static int |
occurencesOf(char toBeFound,
char[] array)
Answers the number of occurrences of the given character in the given array, 0 if any. |
static int |
occurencesOf(char toBeFound,
char[] array,
int start)
Answers the number of occurrences of the given character in the given array starting at the given index, 0 if any. |
static boolean |
pathMatch(char[] pattern,
char[] filepath,
boolean isCaseSensitive,
char pathSeparator)
Answers true if the pattern matches the filepath using the pathSepatator, false otherwise. |
static boolean |
prefixEquals(char[] prefix,
char[] name)
Answers true if the given name starts with the given prefix, false otherwise. |
static boolean |
prefixEquals(char[] prefix,
char[] name,
boolean isCaseSensitive)
Answers true if the given name starts with the given prefix, false otherwise. |
static char[] |
replace(char[] array,
char[] toBeReplaced,
char[] replacementChars)
Answers a new array of characters with substitutions. |
static void |
replace(char[] array,
char toBeReplaced,
char replacementChar)
Replace all occurrence of the character to be replaced with the remplacement character in the given array. |
static char[][] |
splitAndTrimOn(char divider,
char[] array)
Return a new array which is the split of the given array using the given divider and triming each subarray to remove whitespaces equals to ' '. |
static char[][] |
splitOn(char divider,
char[] array)
Return a new array which is the split of the given array using the given divider. |
static char[][] |
splitOn(char divider,
char[] array,
int start,
int end)
Return a new array which is the split of the given array using the given divider. |
static char[][] |
subarray(char[][] array,
int start,
int end)
Answers a new array which is a copy of the given array starting at the given start and ending at the given end. |
static char[] |
subarray(char[] array,
int start,
int end)
Answers a new array which is a copy of the given array starting at the given start and ending at the given end. |
static char[] |
toLowerCase(char[] chars)
Answers the result of a char[] conversion to lowercase. |
static String |
toString(char[][] array)
Answers a string which is the concatenation of the given array using the '.' as a separator. |
static String[] |
toStrings(char[][] array)
Answers an array of strings from the given array of char array. |
static char[] |
trim(char[] chars)
Answers a new array removing leading and trailing spaces (' '). |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final char[] NO_CHAR
public static final char[][] NO_CHAR_CHAR
| 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 concanated 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
NullPointerException - if the target array is null
public 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 String[] charArrayToStringArray(char[][] charArrays)
charArrays - the char array to convert
public static 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 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
NullPointerException - if either array or prefix is null
public 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 concanated 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
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
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
NullPointerException - if array is null or toBeFound is null
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,
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,
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
NullPointerException - if fragment or name is null.public static final int hashCode(char[] array)
array - the array for which a hashcode is required
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
NullPointerException - if array is null
public 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
NullPointerException - if array is null
ArrayIndexOutOfBoundsException - if start is lower than 0
public 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
NullPointerException - if array is null
public 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
NullPointerException - if array is null
ArrayIndexOutOfBoundsException - if startIndex is lower than 0
public 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
NullPointerException - if array is null
ArrayIndexOutOfBoundsException - if endIndex is greater or equals to array length or starting is lower than 0
public static final char[] lastSegment(char[] array,
char separator)
lastSegment("java.lang.Object".toCharArray(),'.') --> Object
array - the arrayseparator - the given separator
NullPointerException - if array is null
public 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
NullPointerException - if array is null
public 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
NullPointerException - if array is null
ArrayIndexOutOfBoundsException - if start is lower than 0
public 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
NullPointerException - if the given name is null or if the given prefix is null
public 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
NullPointerException - if the given name is null or if the given prefix is null
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
NullPointerException - if the given array is 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
NullPointerException - if the given array is null
public 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
ArrayIndexOutOfBoundsException - if start is lower than 0 or end is greater than the array length
public 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
NullPointerException - if the given array is null
public 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
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 String toString(char[][] array)
array = { { 'a' } , { 'b' } }
result => "a.b"
array = { { ' ', 'a' } , { 'b' } }
result => " a.b"
array - the given array
public static final String[] toStrings(char[][] array)
array - the given array
|
Eclipse JDT Release 3.0 |
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||