每天学点Java知识 ------> String类常用方法(字符串截取)

上一篇 / 下一篇  2014-07-25 17:14:29 / 个人分类:Java学习

1.public String substring(int beginIndex)
从指定位置截取到结尾

2.public String substring(int beginIndex, int endIndex)
截取指定范围的内容


public class TestJava{
 public static void main(String args[]){
  String str = "Hello World";
  System.out.println(str.substring(6));
  System.out.println(str.substring(6, 8));
 }
}
程序运行结果:
World
Wo


TAG:

 

评分:0

我来说两句

日历

« 2024-04-22  
 123456
78910111213
14151617181920
21222324252627
282930    

我的存档

数据统计

  • 访问量: 30735
  • 日志数: 41
  • 建立时间: 2014-07-17
  • 更新时间: 2014-07-30

RSS订阅

Open Toolbar