Package org.apache.commons.lang3
Class CharSequenceUtils
java.lang.Object
org.apache.commons.lang3.CharSequenceUtils
Operations on
CharSequence
that are
null
safe.- Since:
- 3.0
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic CharSequence
subSequence
(CharSequence cs, int start) Returns a newCharSequence
that is a subsequence of this sequence starting with thechar
value at the specified index.static char[]
toCharArray
(CharSequence source) Converts the given CharSequence to a char[].
-
Constructor Details
-
CharSequenceUtils
Deprecated.TODO Make private in 4.0.CharSequenceUtils
instances should NOT be constructed in standard programming.This constructor is public to permit tools that require a JavaBean instance to operate.
-
-
Method Details
-
subSequence
Returns a newCharSequence
that is a subsequence of this sequence starting with thechar
value at the specified index.This provides the
CharSequence
equivalent toString.substring(int)
. The length (inchar
) of the returned sequence islength() - start
, so ifstart == end
then an empty sequence is returned.- Parameters:
cs
- the specified subsequence, null returns nullstart
- the start index, inclusive, valid- Returns:
- a new subsequence, may be null
- Throws:
IndexOutOfBoundsException
- ifstart
is negative or ifstart
is greater thanlength()
-
toCharArray
Converts the given CharSequence to a char[].- Parameters:
source
- theCharSequence
to be processed.- Returns:
- the resulting char array, never null.
- Since:
- 3.11
-