统计某字符串中某子串出现的次数
摘要:
class StringDemo1{public static void main(String[] args) {int n = getString("abcdnfgabchedabckkfdnabct","abc");System.out.println("字符串出现的次数为:"+n);}public static int getString(String str,String str1){ int count=0;int index=0;while(true){index = str.indexOf(str1,index);if 阅读全文
posted @ 2012-04-22 15:13 java课程设计 阅读(328) 评论(0) 推荐(0) 编辑