/**
- 直接调用String对象的方法,String.indexOf(pattern);返回子字符串第一次在String中出现的索引,如果不存在子字符串则返回-1
- @author Administrator
*/
public class test {
public static void main(String[] args) {
String txt = "ABACADABRAC";
String pattern = "ABRA";
int i = txt.indexOf(pattern);
System.out.println(i);
}
}