62,614
社区成员
发帖
与我相关
我的任务
分享
String str = "ABCDEFG hi HIJK"
System.out.println(str.indexOf("\bhi\b"));
String str = "ABCDEFG hi HIJK";
String reg = "\\bhi\\b";
Matcher m = Pattern.compile(reg).matcher(str);
if(m.find())
{
System.out.println(m.start());
}
/*------输出--------
8
*/