目录

String substring(int beginIndex)

描述 (Description)

此方法有两个变体,并返回一个新字符串,该字符串是此字符串的子字符串。 子字符串以指定索引处的字符开头,并且如果给出第二个参数,则延伸到此字符串的末尾或最多为endIndex - 1。

语法 (Syntax)

以下是此方法的语法 -

public String substring(int beginIndex)

参数 (Parameters)

这是参数的细节 -

  • beginIndex - 开头索引,包括。

返回值 (Return Value)

  • 指定的子字符串。

例子 (Example)

import java.io.*;
public class Test {
   public static void main(String args[]) {
      String Str = new String("Welcome to iowiki.com");
      System.out.print("Return Value :" );
      System.out.println(Str.substring(10) );
   }
}

这将产生以下结果 -

输出 (Output)

Return Value : iowiki.com
↑回到顶部↑
WIKI教程 @2018