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://codercto.com/courses/l/12.html

查看所有标签

The Book of CSS3

The Book of CSS3

Peter Gasston / No Starch Press / 2011-5-13 / USD 34.95

CSS3 is the technology behind most of the eye-catching visuals on the Web today, but the official documentation can be dry and hard to follow. Luckily, The Book of CSS3 distills the heady technical la......一起来看看 《The Book of CSS3》 这本书的介绍吧!

HTML 压缩/解压工具
HTML 压缩/解压工具

在线压缩/解压 HTML 代码

随机密码生成器
随机密码生成器

多种字符组合密码

MD5 加密
MD5 加密

MD5 加密工具