CharSequenceUtils

public class org.apache.commons.lang3.CharSequenceUtils[source]

Operations on CharSequence that are null safe.

See also:

CharSequence

Since:

3.0

Constructors

CharSequenceUtils()

Deprecated. CharSequenceUtils instances should NOT be constructed in standard programming.

@Deprecated public CharSequenceUtils()[source]

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.

Methods

subSequence(CharSequence, int)

Returns a new CharSequence that is a subsequence of this sequence starting with the char value at the specified index.

toCharArray(CharSequence)

Converts the given CharSequence to a char[].

public static CharSequence subSequence(CharSequence cs, int start)[source]

Returns a new CharSequence that is a subsequence of this sequence starting with the char value at the specified index.

This provides the CharSequence equivalent to String#substring(int). The length (in char) of the returned sequence is length() - start, so if start == end then an empty sequence is returned.

Parameters:
  • cs – The specified subsequence, null returns null.

  • start – The start index, inclusive, valid.

Returns:

A new subsequence, may be null.

Throws:

java.lang.IndexOutOfBoundsException – Thrown if start is negative or if start is greater than length().

public static char[] toCharArray(CharSequence source)[source]

Converts the given CharSequence to a char[].

Parameters:

source – The CharSequence to be processed.

Returns:

The resulting char array, never null.

Since:

3.11