int i=-1;//定义初始化索引值为-1
String str1=“WB0001”;
Matcher matcher=Pattern.compile([“0-9”]).matcher(str1):
if(matcher.find()){
i=matcher.start();
}
System.out.println(i);
02-09
4624
int i=-1;//定义初始化索引值为-1
String str1=“WB0001”;
Matcher matcher=Pattern.compile([“0-9”]).matcher(str1):
if(matcher.find()){
i=matcher.start();
}
System.out.println(i);