org.apache.commons.lang3
Class CharSequenceUtils

java.lang.Object
  extended by org.apache.commons.lang3.CharSequenceUtils

public class CharSequenceUtils
extends Object

Null-safe CharSequence utility methods.

Version:
$Id: CharSequenceUtils.java 967237 2010-07-23 20:08:57Z mbenson $
Author:
Gary Gregory

Constructor Summary
CharSequenceUtils()
           
 
Method Summary
static int length(CharSequence cs)
          Gets a CharSequence length or 0 if the CharSequence is null.
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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CharSequenceUtils

public CharSequenceUtils()
Method Detail

length

public static int length(CharSequence cs)
Gets a CharSequence length or 0 if the CharSequence is null.

Parameters:
cs - a CharSequence or null
Returns:
CharSequence length or 0 if the CharSequence is null.
Since:
3.0

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. The length (in chars) of the returned sequence is length() - start, so if start == end then an empty sequence is returned.

Parameters:
cs - the specified subsequence, may be null
start - the start index, inclusive
Returns:
a new subsequence or null
Throws:
IndexOutOfBoundsException - if start is negative or if start is greater than length()
Since:
3.0


Copyright © 2001-2010 The Apache Software Foundation. All Rights Reserved.