
//功能:暴力字符匹配.找到返回下标位置,未找到返回-1
public class BF {
public static void main(String[] args) {
String str1="hdlloworld-helloworld";
String str2="ell";
int index = new BF().bf(str1.toCharArray(),str2.toCharArray());
System.out.println(index);
}
private int bf(char[] str1, char[] str2) {
int i = 0;
int j = 0;
while ( i欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)