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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic CharSequencesubSequence(CharSequence cs, int start) Returns a newCharSequencethat is a subsequence of this sequence starting with thecharvalue 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.CharSequenceUtilsinstances 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 newCharSequencethat is a subsequence of this sequence starting with thecharvalue at the specified index.This provides the
CharSequenceequivalent toString.substring(int). The length (inchar) of the returned sequence islength() - start, so ifstart == endthen 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- ifstartis negative or ifstartis greater thanlength()
-
toCharArray
Converts the given CharSequence to a char[].- Parameters:
source- theCharSequenceto be processed.- Returns:
- the resulting char array, never null.
- Since:
- 3.11
-