數(shù)據(jù)加載中……
          FindSubstring.java
          /**
          *查找特定的子串
          */
          public class FindSubstring{
          public static void main(String[] args){
          String str="Welcome the body.";
          System.out.println("Find the substring boy occurrence:"+str.indexOf("boy"));//查找子串
          System.out.println("Find the substring by occurrence: "+str.indexOf("by"));//查找子串
          System.out.println("Find the char t occurrence: "+str.indexOf('t'));//查找特定的字符
          System.out.println("Test the string begin with wel.:"+str.startsWith("wel"));//是否以"wel"開始
          System.out.pritnln("Test the string end with body.:"+str.endWith("boy"));//是否以"boy"結(jié)束
          }
          }

          posted on 2008-10-22 13:06 郭興華 閱讀(201) 評(píng)論(0)  編輯  收藏


          只有注冊(cè)用戶登錄后才能發(fā)表評(píng)論。


          網(wǎng)站導(dǎo)航:
           
          主站蜘蛛池模板: 四会市| 淳化县| 华安县| 新昌县| 彝良县| 安徽省| 易门县| 遂川县| 安康市| 贵南县| 平谷区| 高台县| 高州市| 从江县| 东丽区| 汉沽区| 两当县| 醴陵市| 上高县| 沂南县| 桂东县| 安阳县| 肇庆市| 南和县| 历史| 屯昌县| 郧西县| 洪洞县| 且末县| 银川市| 洛川县| 望城县| 通道| 阳谷县| 龙川县| 左贡县| 邢台县| 洪湖市| 怀集县| 广安市| 任丘市|