Java subSequence() 方法

Java 教程 · 2019-02-09 06:58:08

subSequence() 方法返回一个新的字符序列,它是此序列的一个子序列。

语法

public CharSequence subSequence(int beginIndex, int endIndex)

参数

  • beginIndex -- 起始索引(包括)。

  • endIndex -- 结束索引(不包括)。

返回值

返回一个新的字符序列,它是此序列的一个子序列。

实例

public class Test {
    public static void main(String args[]) {
         String Str = new String("www.codercto.com");

         System.out.print("返回值 :" );
         System.out.println(Str.subSequence(4, 10) );
    }
}

以上程序执行结果为:

返回值 :codercto

点击查看所有 Java 教程 文章: https://www.codercto.com/courses/l/12.html

查看所有标签

How to Design Programs

How to Design Programs

Matthias Felleisen、Robert Bruce Findler、Matthew Flatt、Shriram Krishnamurthi / The MIT Press / 2001-2-12 / 71.00美元

This introduction to programming places computer science in the core of a liberal arts education. Unlike other introductory books, it focuses on the program design process. This approach fosters a var......一起来看看 《How to Design Programs》 这本书的介绍吧!

图片转BASE64编码
图片转BASE64编码

在线图片转Base64编码工具

URL 编码/解码
URL 编码/解码

URL 编码/解码

RGB HSV 转换
RGB HSV 转换

RGB HSV 互转工具