org.apache.commons.lang3

## Class CharSequenceUtils

- java.lang.Object
- - org.apache.commons.lang3.CharSequenceUtils

-     public class CharSequenceUtils
      extends Object

  Operations on `CharSequence` that are `null` safe.

  Since:
    3.0
  See Also:
    `CharSequence`

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `CharSequenceUtils()` `CharSequenceUtils` instances should NOT be constructed in standard programming.

  - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static CharSequence` | `subSequence(CharSequence cs, int start)` Returns a new `CharSequence` that is a subsequence of this sequence starting with the `char` value at the specified index.
    `static char[]` | `toCharArray(CharSequence source)` Converts the given CharSequence to a char[].

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### CharSequenceUtils

          public CharSequenceUtils()

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

      This constructor is public to permit tools that require a JavaBean instance to operate.

  - ### Method Detail

    - #### subSequence

          public static CharSequence subSequence(CharSequence cs,
                                                 int start)

      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:
        `IndexOutOfBoundsException` - if `start` is negative or if `start` is greater than `length()`

    - #### toCharArray

          public static char[] toCharArray(CharSequence 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

Copyright © 2001–2021 The Apache Software Foundation. All rights reserved.