天津大闸蟹价格:有道JAVA题!谢谢大家的帮忙

来源:百度文库 编辑:中科新闻网 时间:2024/05/04 19:57:04
编写一个Extractring程序,从字符串“Size the Day”中提取单词“the”和“Day”。

用subString方法来截取子字符串比如
String s="Seize the Day";
String sub1=s.subString(6,8);
//因为"the"第一次出现的位置是6,所以截取6-8,正好是the
String sub2=s.subString(10,12);
//截取"Day",原理同上。