统计大串中小串出现的次数
package com.toov5.test; public class Test3 { public static void main(String[] args) { String max = "okokvv,okwer,wroksdf,fsdf"; String min = "ok"; int count = 0; int index = 0; while ((index = max.indexOf(min)) !=-1 ) { count ++; max = max.substring(index+min.length()); } System.out.println(count); } }