Java substring() 方法
Java 教程
· 2019-02-09 07:13:08
substring() 方法返回字符串的子字符串。
语法
public String substring(int beginIndex) 或 public String substring(int beginIndex, int endIndex)
参数
beginIndex -- 起始索引(包括), 索引从 0 开始。
endIndex -- 结束索引(不包括)。
返回值
子字符串。
实例
public class Test {
public static void main(String args[]) {
String Str = new String("www.codercto.com");
System.out.print("返回值 :" );
System.out.println(Str.substring(4) );
System.out.print("返回值 :" );
System.out.println(Str.substring(4, 10) );
}
}
以上程序执行结果为:
返回值 :codercto.com 返回值 :codercto
点击查看所有 Java 教程 文章: https://www.codercto.com/courses/l/12.html
Head First JavaScript Programming
Eric T. Freeman、Elisabeth Robson / O'Reilly Media / 2014-4-10 / USD 49.99
This brain-friendly guide teaches you everything from JavaScript language fundamentals to advanced topics, including objects, functions, and the browser’s document object model. You won’t just be read......一起来看看 《Head First JavaScript Programming》 这本书的介绍吧!