Package org.apache.commons.lang3
Class CharSequenceUtils
- java.lang.Object
-
- org.apache.commons.lang3.CharSequenceUtils
-
public class CharSequenceUtils extends java.lang.ObjectOperations on
CharSequencethat arenullsafe.- Since:
- 3.0
- See Also:
CharSequence
-
-
Constructor Summary
Constructors Constructor Description CharSequenceUtils()CharSequenceUtilsinstances should NOT be constructed in standard programming.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.CharSequencesubSequence(java.lang.CharSequence cs, int start)Returns a newCharSequencethat is a subsequence of this sequence starting with thecharvalue at the specified index.static char[]toCharArray(java.lang.CharSequence source)Converts the given CharSequence to a char[].
-
-
-
Method Detail
-
subSequence
public static java.lang.CharSequence subSequence(java.lang.CharSequence cs, int start)Returns a new
CharSequencethat 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:
java.lang.IndexOutOfBoundsException- ifstartis negative or ifstartis greater thanlength()
-
toCharArray
public static char[] toCharArray(java.lang.CharSequence source)
Converts the given CharSequence to a char[].- Parameters:
source- theCharSequenceto be processed.- Returns:
- the resulting char array, never null.
- Since:
- 3.11
-
-