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);
09-06
1066
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
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);