commons之CharSequenceUtils

 

import org.apache.commons.lang3.CharSequenceUtils;

public class CharSequenceUtilsDemo {

	private static final CharSequence cs = "hello";
	private static final CharSequence n = null;

	/**
	 * @param args
	 */
	public static void main(String[] args) {

		/*
		 * 获得字符序列的长度
		 */
		System.out.println("length:"+CharSequenceUtils.length(cs));
		
		/*
		 * 从start开始截取字符序列,返回start后面的字符序列.
		 * 如果为null,返回null,无论start为多少.
		 */
		System.out.println(CharSequenceUtils.subSequence(n, 1));
		
		
	}

}

你可能感兴趣的:(apache)