數(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"開(kāi)始
          System.out.pritnln("Test the string end with body.:"+str.endWith("boy"));//是否以"boy"結(jié)束
          }
          }

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


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


          網(wǎng)站導(dǎo)航:
           
          主站蜘蛛池模板: 博罗县| 祁连县| 龙井市| 吉安市| 襄汾县| 德令哈市| 定结县| 阜阳市| 九江市| 漠河县| 和田市| 红安县| 抚宁县| 平阴县| 河北省| 镇平县| 肃北| 五大连池市| 镶黄旗| 黔江区| 施甸县| 子长县| 沙河市| 盐城市| 麻城市| 五莲县| 东安县| 德阳市| 平乐县| 盐城市| 正宁县| 双柏县| 威信县| 上杭县| 盘锦市| 拜城县| 宜阳县| 包头市| 鹿邑县| 健康| 枞阳县|