subSequence() 方法返回一个新的字符序列,它是此序列的一个子序列。
public CharSequence subSequence(int beginIndex, int endIndex)
beginIndex -- 起始索引(包括)。
endIndex -- 结束索引(不包括)。
返回一个新的字符序列,它是此序列的一个子序列。
public class Test {
public static void main(String args[]) {
String Str = new String("www.itzixishi.com");
System.out.print("返回值 :" );
System.out.println(Str.subSequence(4, 13) );
}
}
以上程序执行结果为:
返回值 :itzixishi
©2020 IT自习室京ICP备20010815号