Class ApacheCommonsLangUtil
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
The empty String""
.static final int
The index value when an element is not found in a list or array:-1
. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T> T[]
addAll
(T[] array1, T... array2) Adds all the elements of the given arrays into a new array.static String
capitalize
(String str) Capitalizes all the whitespace separated words in a String.static String
capitalize
(String str, char... delimiters) Capitalizes all the delimiter separated words in a String.static String
capitalizeFully
(String str) Converts all the whitespace separated words in a String into capitalized words, that is each word is made up of a titlecase character and then a series of lowercase characters.static String
capitalizeFully
(String str, char... delimiters) Converts all the delimiter separated words in a String into capitalized words, that is each word is made up of a titlecase character and then a series of lowercase characters.static <T> T[]
clone
(T[] array) Shallow clones an array returning a typecast result and handlingnull
.static int
Finds the index of the given object in the array.static int
Finds the index of the given object in the array starting at the given index.static boolean
isDelimiter
(char ch, char[] delimiters) Is the character a delimiter.static boolean
Checks if the CharSequence contains only Unicode digits.static String
join
(byte[] array, char separator) Joins the elements of the provided array into a single String containing the provided list of elements.static String
join
(byte[] array, char separator, int startIndex, int endIndex) Joins the elements of the provided array into a single String containing the provided list of elements.static String
join
(char[] array, char separator) Joins the elements of the provided array into a single String containing the provided list of elements.static String
join
(char[] array, char separator, int startIndex, int endIndex) Joins the elements of the provided array into a single String containing the provided list of elements.static String
join
(double[] array, char separator) Joins the elements of the provided array into a single String containing the provided list of elements.static String
join
(double[] array, char separator, int startIndex, int endIndex) Joins the elements of the provided array into a single String containing the provided list of elements.static String
join
(float[] array, char separator) Joins the elements of the provided array into a single String containing the provided list of elements.static String
join
(float[] array, char separator, int startIndex, int endIndex) Joins the elements of the provided array into a single String containing the provided list of elements.static String
join
(int[] array, char separator) Joins the elements of the provided array into a single String containing the provided list of elements.static String
join
(int[] array, char separator, int startIndex, int endIndex) Joins the elements of the provided array into a single String containing the provided list of elements.static String
join
(long[] array, char separator) Joins the elements of the provided array into a single String containing the provided list of elements.static String
join
(long[] array, char separator, int startIndex, int endIndex) Joins the elements of the provided array into a single String containing the provided list of elements.static String
join
(short[] array, char separator) Joins the elements of the provided array into a single String containing the provided list of elements.static String
join
(short[] array, char separator, int startIndex, int endIndex) Joins the elements of the provided array into a single String containing the provided list of elements.static String
Joins the elements of the providedIterable
into a single String containing the provided elements.static String
Joins the elements of the providedIterable
into a single String containing the provided elements.static String
Joins the elements of the provided array into a single String containing the provided list of elements.static String
Joins the elements of the provided array into a single String containing the provided list of elements.static String
Joins the elements of the provided array into a single String containing the provided list of elements.static String
Joins the elements of the provided array into a single String containing the provided list of elements.static String
Joins the elements of the providedIterator
into a single String containing the provided elements.static String
Joins the elements of the providedIterator
into a single String containing the provided elements.static <T> String
join
(T... elements) Joins the elements of the provided array into a single String containing the provided list of elements.static boolean
startsWith
(CharSequence str, CharSequence prefix) Check if a CharSequence starts with a specified prefix.static boolean
startsWithIgnoreCase
(CharSequence str, CharSequence prefix) Case insensitive check if a CharSequence starts with a specified prefix.
-
Field Details
-
EMPTY
The empty String""
.- Since:
- 2.0
- See Also:
-
INDEX_NOT_FOUND
The index value when an element is not found in a list or array:-1
. This value is returned by methods in this class and can also be used in comparisons with values returned by various method fromList
.- See Also:
-
-
Constructor Details
-
ApacheCommonsLangUtil
public ApacheCommonsLangUtil()
-
-
Method Details
-
clone
Shallow clones an array returning a typecast result and handling
null
.The objects in the array are not cloned, thus there is no special handling for multi-dimensional arrays.
This method returns
null
for anull
input array.- Type Parameters:
T
- the component type of the array- Parameters:
array
- the array to shallow clone, may benull
- Returns:
- the cloned array,
null
ifnull
input
-
addAll
Adds all the elements of the given arrays into a new array.
The new array contains all of the element of
array1
followed by all of the elementsarray2
. When an array is returned, it is always a new array.ArrayUtils.addAll(null, null) = null ArrayUtils.addAll(array1, null) = cloned copy of array1 ArrayUtils.addAll(null, array2) = cloned copy of array2 ArrayUtils.addAll([], []) = [] ArrayUtils.addAll([null], [null]) = [null, null] ArrayUtils.addAll(["a", "b", "c"], ["1", "2", "3"]) = ["a", "b", "c", "1", "2", "3"]
- Type Parameters:
T
- the component type of the array- Parameters:
array1
- the first array whose elements are added to the new array, may benull
array2
- the second array whose elements are added to the new array, may benull
- Returns:
- The new array,
null
if both arrays arenull
. The type of the new array is the type of the first array, unless the first array is null, in which case the type is the same as the second array. - Throws:
IllegalArgumentException
- if the array types are incompatible- Since:
- 2.1
-
capitalizeFully
Converts all the whitespace separated words in a String into capitalized words, that is each word is made up of a titlecase character and then a series of lowercase characters.
Whitespace is defined by
Character.isWhitespace(char)
. Anull
input String returnsnull
. Capitalization uses the Unicode title case, normally equivalent to upper case.WordUtils.capitalizeFully(null) = null WordUtils.capitalizeFully("") = "" WordUtils.capitalizeFully("i am FINE") = "I Am Fine"
- Parameters:
str
- the String to capitalize, may be null- Returns:
- capitalized String,
null
if null String input
-
capitalizeFully
Converts all the delimiter separated words in a String into capitalized words, that is each word is made up of a titlecase character and then a series of lowercase characters.
The delimiters represent a set of characters understood to separate words. The first string character and the first non-delimiter character after a delimiter will be capitalized.
A
null
input String returnsnull
. Capitalization uses the Unicode title case, normally equivalent to upper case.WordUtils.capitalizeFully(null, *) = null WordUtils.capitalizeFully("", *) = "" WordUtils.capitalizeFully(*, null) = * WordUtils.capitalizeFully(*, new char[0]) = * WordUtils.capitalizeFully("i aM.fine", {'.'}) = "I am.Fine"
- Parameters:
str
- the String to capitalize, may be nulldelimiters
- set of characters to determine capitalization, null means whitespace- Returns:
- capitalized String,
null
if null String input - Since:
- 2.1
-
capitalize
Capitalizes all the whitespace separated words in a String. Only the first character of each word is changed. To convert the rest of each word to lowercase at the same time, use
capitalizeFully(String)
.Whitespace is defined by
Character.isWhitespace(char)
. Anull
input String returnsnull
. Capitalization uses the Unicode title case, normally equivalent to upper case.WordUtils.capitalize(null) = null WordUtils.capitalize("") = "" WordUtils.capitalize("i am FINE") = "I Am FINE"
- Parameters:
str
- the String to capitalize, may be null- Returns:
- capitalized String,
null
if null String input - See Also:
-
capitalize
Capitalizes all the delimiter separated words in a String. Only the first character of each word is changed. To convert the rest of each word to lowercase at the same time, use
capitalizeFully(String, char[])
.The delimiters represent a set of characters understood to separate words. The first string character and the first non-delimiter character after a delimiter will be capitalized.
A
null
input String returnsnull
. Capitalization uses the Unicode title case, normally equivalent to upper case.WordUtils.capitalize(null, *) = null WordUtils.capitalize("", *) = "" WordUtils.capitalize(*, new char[0]) = * WordUtils.capitalize("i am fine", null) = "I Am Fine" WordUtils.capitalize("i aM.fine", {'.'}) = "I aM.Fine"
- Parameters:
str
- the String to capitalize, may be nulldelimiters
- set of characters to determine capitalization, null means whitespace- Returns:
- capitalized String,
null
if null String input - Since:
- 2.1
- See Also:
-
isDelimiter
Is the character a delimiter.- Parameters:
ch
- the character to checkdelimiters
- the delimiters- Returns:
- true if it is a delimiter
-
join
Joins the elements of the provided array into a single String containing the provided list of elements.
No separator is added to the joined String. Null objects or empty strings within the array are represented by empty strings.
StringUtils.join(null) = null StringUtils.join([]) = "" StringUtils.join([null]) = "" StringUtils.join(["a", "b", "c"]) = "abc" StringUtils.join([null, "", "a"]) = "a"
- Type Parameters:
T
- the specific type of values to join together- Parameters:
elements
- the values to join together, may be null- Returns:
- the joined String,
null
if null array input - Since:
- 2.0, 3.0 Changed signature to use varargs
-
join
Joins the elements of the provided array into a single String containing the provided list of elements.
No delimiter is added before or after the list. Null objects or empty strings within the array are represented by empty strings.
StringUtils.join(null, *) = null StringUtils.join([], *) = "" StringUtils.join([null], *) = "" StringUtils.join(["a", "b", "c"], ';') = "a;b;c" StringUtils.join(["a", "b", "c"], null) = "abc" StringUtils.join([null, "", "a"], ';') = ";;a"
- Parameters:
array
- the array of values to join together, may be nullseparator
- the separator character to use- Returns:
- the joined String,
null
if null array input - Since:
- 2.0
-
join
Joins the elements of the provided array into a single String containing the provided list of elements.
No delimiter is added before or after the list. Null objects or empty strings within the array are represented by empty strings.
StringUtils.join(null, *) = null StringUtils.join([], *) = "" StringUtils.join([null], *) = "" StringUtils.join([1, 2, 3], ';') = "1;2;3" StringUtils.join([1, 2, 3], null) = "123"
- Parameters:
array
- the array of values to join together, may be nullseparator
- the separator character to use- Returns:
- the joined String,
null
if null array input - Since:
- 3.2
-
join
Joins the elements of the provided array into a single String containing the provided list of elements.
No delimiter is added before or after the list. Null objects or empty strings within the array are represented by empty strings.
StringUtils.join(null, *) = null StringUtils.join([], *) = "" StringUtils.join([null], *) = "" StringUtils.join([1, 2, 3], ';') = "1;2;3" StringUtils.join([1, 2, 3], null) = "123"
- Parameters:
array
- the array of values to join together, may be nullseparator
- the separator character to use- Returns:
- the joined String,
null
if null array input - Since:
- 3.2
-
join
Joins the elements of the provided array into a single String containing the provided list of elements.
No delimiter is added before or after the list. Null objects or empty strings within the array are represented by empty strings.
StringUtils.join(null, *) = null StringUtils.join([], *) = "" StringUtils.join([null], *) = "" StringUtils.join([1, 2, 3], ';') = "1;2;3" StringUtils.join([1, 2, 3], null) = "123"
- Parameters:
array
- the array of values to join together, may be nullseparator
- the separator character to use- Returns:
- the joined String,
null
if null array input - Since:
- 3.2
-
join
Joins the elements of the provided array into a single String containing the provided list of elements.
No delimiter is added before or after the list. Null objects or empty strings within the array are represented by empty strings.
StringUtils.join(null, *) = null StringUtils.join([], *) = "" StringUtils.join([null], *) = "" StringUtils.join([1, 2, 3], ';') = "1;2;3" StringUtils.join([1, 2, 3], null) = "123"
- Parameters:
array
- the array of values to join together, may be nullseparator
- the separator character to use- Returns:
- the joined String,
null
if null array input - Since:
- 3.2
-
join
Joins the elements of the provided array into a single String containing the provided list of elements.
No delimiter is added before or after the list. Null objects or empty strings within the array are represented by empty strings.
StringUtils.join(null, *) = null StringUtils.join([], *) = "" StringUtils.join([null], *) = "" StringUtils.join([1, 2, 3], ';') = "1;2;3" StringUtils.join([1, 2, 3], null) = "123"
- Parameters:
array
- the array of values to join together, may be nullseparator
- the separator character to use- Returns:
- the joined String,
null
if null array input - Since:
- 3.2
-
join
Joins the elements of the provided array into a single String containing the provided list of elements.
No delimiter is added before or after the list. Null objects or empty strings within the array are represented by empty strings.
StringUtils.join(null, *) = null StringUtils.join([], *) = "" StringUtils.join([null], *) = "" StringUtils.join([1, 2, 3], ';') = "1;2;3" StringUtils.join([1, 2, 3], null) = "123"
- Parameters:
array
- the array of values to join together, may be nullseparator
- the separator character to use- Returns:
- the joined String,
null
if null array input - Since:
- 3.2
-
join
Joins the elements of the provided array into a single String containing the provided list of elements.
No delimiter is added before or after the list. Null objects or empty strings within the array are represented by empty strings.
StringUtils.join(null, *) = null StringUtils.join([], *) = "" StringUtils.join([null], *) = "" StringUtils.join([1, 2, 3], ';') = "1;2;3" StringUtils.join([1, 2, 3], null) = "123"
- Parameters:
array
- the array of values to join together, may be nullseparator
- the separator character to use- Returns:
- the joined String,
null
if null array input - Since:
- 3.2
-
join
Joins the elements of the provided array into a single String containing the provided list of elements.
No delimiter is added before or after the list. Null objects or empty strings within the array are represented by empty strings.
StringUtils.join(null, *) = null StringUtils.join([], *) = "" StringUtils.join([null], *) = "" StringUtils.join(["a", "b", "c"], ';') = "a;b;c" StringUtils.join(["a", "b", "c"], null) = "abc" StringUtils.join([null, "", "a"], ';') = ";;a"
- Parameters:
array
- the array of values to join together, may be nullseparator
- the separator character to usestartIndex
- the first index to start joining from. It is an error to pass in an end index past the end of the arrayendIndex
- the index to stop joining from (exclusive). It is an error to pass in an end index past the end of the array- Returns:
- the joined String,
null
if null array input - Since:
- 2.0
-
join
Joins the elements of the provided array into a single String containing the provided list of elements.
No delimiter is added before or after the list. Null objects or empty strings within the array are represented by empty strings.
StringUtils.join(null, *) = null StringUtils.join([], *) = "" StringUtils.join([null], *) = "" StringUtils.join([1, 2, 3], ';') = "1;2;3" StringUtils.join([1, 2, 3], null) = "123"
- Parameters:
array
- the array of values to join together, may be nullseparator
- the separator character to usestartIndex
- the first index to start joining from. It is an error to pass in an end index past the end of the arrayendIndex
- the index to stop joining from (exclusive). It is an error to pass in an end index past the end of the array- Returns:
- the joined String,
null
if null array input - Since:
- 3.2
-
join
Joins the elements of the provided array into a single String containing the provided list of elements.
No delimiter is added before or after the list. Null objects or empty strings within the array are represented by empty strings.
StringUtils.join(null, *) = null StringUtils.join([], *) = "" StringUtils.join([null], *) = "" StringUtils.join([1, 2, 3], ';') = "1;2;3" StringUtils.join([1, 2, 3], null) = "123"
- Parameters:
array
- the array of values to join together, may be nullseparator
- the separator character to usestartIndex
- the first index to start joining from. It is an error to pass in an end index past the end of the arrayendIndex
- the index to stop joining from (exclusive). It is an error to pass in an end index past the end of the array- Returns:
- the joined String,
null
if null array input - Since:
- 3.2
-
join
Joins the elements of the provided array into a single String containing the provided list of elements.
No delimiter is added before or after the list. Null objects or empty strings within the array are represented by empty strings.
StringUtils.join(null, *) = null StringUtils.join([], *) = "" StringUtils.join([null], *) = "" StringUtils.join([1, 2, 3], ';') = "1;2;3" StringUtils.join([1, 2, 3], null) = "123"
- Parameters:
array
- the array of values to join together, may be nullseparator
- the separator character to usestartIndex
- the first index to start joining from. It is an error to pass in an end index past the end of the arrayendIndex
- the index to stop joining from (exclusive). It is an error to pass in an end index past the end of the array- Returns:
- the joined String,
null
if null array input - Since:
- 3.2
-
join
Joins the elements of the provided array into a single String containing the provided list of elements.
No delimiter is added before or after the list. Null objects or empty strings within the array are represented by empty strings.
StringUtils.join(null, *) = null StringUtils.join([], *) = "" StringUtils.join([null], *) = "" StringUtils.join([1, 2, 3], ';') = "1;2;3" StringUtils.join([1, 2, 3], null) = "123"
- Parameters:
array
- the array of values to join together, may be nullseparator
- the separator character to usestartIndex
- the first index to start joining from. It is an error to pass in an end index past the end of the arrayendIndex
- the index to stop joining from (exclusive). It is an error to pass in an end index past the end of the array- Returns:
- the joined String,
null
if null array input - Since:
- 3.2
-
join
Joins the elements of the provided array into a single String containing the provided list of elements.
No delimiter is added before or after the list. Null objects or empty strings within the array are represented by empty strings.
StringUtils.join(null, *) = null StringUtils.join([], *) = "" StringUtils.join([null], *) = "" StringUtils.join([1, 2, 3], ';') = "1;2;3" StringUtils.join([1, 2, 3], null) = "123"
- Parameters:
array
- the array of values to join together, may be nullseparator
- the separator character to usestartIndex
- the first index to start joining from. It is an error to pass in an end index past the end of the arrayendIndex
- the index to stop joining from (exclusive). It is an error to pass in an end index past the end of the array- Returns:
- the joined String,
null
if null array input - Since:
- 3.2
-
join
Joins the elements of the provided array into a single String containing the provided list of elements.
No delimiter is added before or after the list. Null objects or empty strings within the array are represented by empty strings.
StringUtils.join(null, *) = null StringUtils.join([], *) = "" StringUtils.join([null], *) = "" StringUtils.join([1, 2, 3], ';') = "1;2;3" StringUtils.join([1, 2, 3], null) = "123"
- Parameters:
array
- the array of values to join together, may be nullseparator
- the separator character to usestartIndex
- the first index to start joining from. It is an error to pass in an end index past the end of the arrayendIndex
- the index to stop joining from (exclusive). It is an error to pass in an end index past the end of the array- Returns:
- the joined String,
null
if null array input - Since:
- 3.2
-
join
Joins the elements of the provided array into a single String containing the provided list of elements.
No delimiter is added before or after the list. Null objects or empty strings within the array are represented by empty strings.
StringUtils.join(null, *) = null StringUtils.join([], *) = "" StringUtils.join([null], *) = "" StringUtils.join([1, 2, 3], ';') = "1;2;3" StringUtils.join([1, 2, 3], null) = "123"
- Parameters:
array
- the array of values to join together, may be nullseparator
- the separator character to usestartIndex
- the first index to start joining from. It is an error to pass in an end index past the end of the arrayendIndex
- the index to stop joining from (exclusive). It is an error to pass in an end index past the end of the array- Returns:
- the joined String,
null
if null array input - Since:
- 3.2
-
join
Joins the elements of the provided array into a single String containing the provided list of elements.
No delimiter is added before or after the list. A
null
separator is the same as an empty String (""). Null objects or empty strings within the array are represented by empty strings.StringUtils.join(null, *) = null StringUtils.join([], *) = "" StringUtils.join([null], *) = "" StringUtils.join(["a", "b", "c"], "--") = "a--b--c" StringUtils.join(["a", "b", "c"], null) = "abc" StringUtils.join(["a", "b", "c"], "") = "abc" StringUtils.join([null, "", "a"], ',') = ",,a"
- Parameters:
array
- the array of values to join together, may be nullseparator
- the separator character to use, null treated as ""- Returns:
- the joined String,
null
if null array input
-
join
Joins the elements of the provided array into a single String containing the provided list of elements.
No delimiter is added before or after the list. A
null
separator is the same as an empty String (""). Null objects or empty strings within the array are represented by empty strings.StringUtils.join(null, *, *, *) = null StringUtils.join([], *, *, *) = "" StringUtils.join([null], *, *, *) = "" StringUtils.join(["a", "b", "c"], "--", 0, 3) = "a--b--c" StringUtils.join(["a", "b", "c"], "--", 1, 3) = "b--c" StringUtils.join(["a", "b", "c"], "--", 2, 3) = "c" StringUtils.join(["a", "b", "c"], "--", 2, 2) = "" StringUtils.join(["a", "b", "c"], null, 0, 3) = "abc" StringUtils.join(["a", "b", "c"], "", 0, 3) = "abc" StringUtils.join([null, "", "a"], ',', 0, 3) = ",,a"
- Parameters:
array
- the array of values to join together, may be nullseparator
- the separator character to use, null treated as ""startIndex
- the first index to start joining from.endIndex
- the index to stop joining from (exclusive).- Returns:
- the joined String,
null
if null array input; or the empty string ifendIndex - startIndex <= 0
. The number of joined entries is given byendIndex - startIndex
- Throws:
ArrayIndexOutOfBoundsException
- ife
startIndex < 0
or
startIndex >= array.length()
or
endIndex < 0
or
endIndex > array.length()
-
join
Joins the elements of the provided
Iterator
into a single String containing the provided elements.No delimiter is added before or after the list. Null objects or empty strings within the iteration are represented by empty strings.
See the examples here:
join(Object[],char)
.- Parameters:
iterator
- theIterator
of values to join together, may be nullseparator
- the separator character to use- Returns:
- the joined String,
null
if null iterator input - Since:
- 2.0
-
join
Joins the elements of the provided
Iterator
into a single String containing the provided elements.No delimiter is added before or after the list. A
null
separator is the same as an empty String ("").See the examples here:
join(Object[],String)
.- Parameters:
iterator
- theIterator
of values to join together, may be nullseparator
- the separator character to use, null treated as ""- Returns:
- the joined String,
null
if null iterator input
-
join
Joins the elements of the provided
Iterable
into a single String containing the provided elements.No delimiter is added before or after the list. Null objects or empty strings within the iteration are represented by empty strings.
See the examples here:
join(Object[],char)
.- Parameters:
iterable
- theIterable
providing the values to join together, may be nullseparator
- the separator character to use- Returns:
- the joined String,
null
if null iterator input - Since:
- 2.3
-
join
Joins the elements of the provided
Iterable
into a single String containing the provided elements.No delimiter is added before or after the list. A
null
separator is the same as an empty String ("").See the examples here:
join(Object[],String)
.- Parameters:
iterable
- theIterable
providing the values to join together, may be nullseparator
- the separator character to use, null treated as ""- Returns:
- the joined String,
null
if null iterator input - Since:
- 2.3
-
isNumeric
Checks if the CharSequence contains only Unicode digits. A decimal point is not a Unicode digit and returns false.
null
will returnfalse
. An empty CharSequence (length()=0) will returnfalse
.Note that the method does not allow for a leading sign, either positive or negative. Also, if a String passes the numeric test, it may still generate a NumberFormatException when parsed by Integer.parseInt or Long.parseLong, e.g. if the value is outside the range for int or long respectively.
StringUtils.isNumeric(null) = false StringUtils.isNumeric("") = false StringUtils.isNumeric(" ") = false StringUtils.isNumeric("123") = true StringUtils.isNumeric("१२३") = true StringUtils.isNumeric("12 3") = false StringUtils.isNumeric("ab2c") = false StringUtils.isNumeric("12-3") = false StringUtils.isNumeric("12.3") = false StringUtils.isNumeric("-123") = false StringUtils.isNumeric("+123") = false
- Parameters:
cs
- the CharSequence to check, may be null- Returns:
true
if only contains digits, and is non-null- Since:
- 3.0 Changed signature from isNumeric(String) to isNumeric(CharSequence), 3.0 Changed "" to return false and not true
-
startsWith
Check if a CharSequence starts with a specified prefix.
null
s are handled without exceptions. Twonull
references are considered to be equal. The comparison is case sensitive.StringUtils.startsWith(null, null) = true StringUtils.startsWith(null, "abc") = false StringUtils.startsWith("abcdef", null) = false StringUtils.startsWith("abcdef", "abc") = true StringUtils.startsWith("ABCDEF", "abc") = false
- Parameters:
str
- the CharSequence to check, may be nullprefix
- the prefix to find, may be null- Returns:
true
if the CharSequence starts with the prefix, case sensitive, or bothnull
- Since:
- 2.4, 3.0 Changed signature from startsWith(String, String) to startsWith(CharSequence, CharSequence)
- See Also:
-
startsWithIgnoreCase
Case insensitive check if a CharSequence starts with a specified prefix.
null
s are handled without exceptions. Twonull
references are considered to be equal. The comparison is case insensitive.StringUtils.startsWithIgnoreCase(null, null) = true StringUtils.startsWithIgnoreCase(null, "abc") = false StringUtils.startsWithIgnoreCase("abcdef", null) = false StringUtils.startsWithIgnoreCase("abcdef", "abc") = true StringUtils.startsWithIgnoreCase("ABCDEF", "abc") = true
- Parameters:
str
- the CharSequence to check, may be nullprefix
- the prefix to find, may be null- Returns:
true
if the CharSequence starts with the prefix, case insensitive, or bothnull
- Since:
- 2.4, 3.0 Changed signature from startsWithIgnoreCase(String, String) to startsWithIgnoreCase(CharSequence, CharSequence)
- See Also:
-
indexOf
Finds the index of the given object in the array.
This method returns
INDEX_NOT_FOUND
(-1
) for anull
input array.- Parameters:
array
- the array to search through for the object, may benull
objectToFind
- the object to find, may benull
- Returns:
- the index of the object within the array,
INDEX_NOT_FOUND
(-1
) if not found ornull
array input
-
indexOf
Finds the index of the given object in the array starting at the given index.
This method returns
INDEX_NOT_FOUND
(-1
) for anull
input array.A negative startIndex is treated as zero. A startIndex larger than the array length will return
INDEX_NOT_FOUND
(-1
).- Parameters:
array
- the array to search through for the object, may benull
objectToFind
- the object to find, may benull
startIndex
- the index to start searching at- Returns:
- the index of the object within the array starting at the index,
INDEX_NOT_FOUND
(-1
) if not found ornull
array input
-