串匹配:根据前缀和后缀确定目标子串

这样就行: 

String str = prefix + keyword + postfix; //如"prefix" + "Keyword" + "Postfix"
return str.substring(prefix.length(), str.indexOf(postfix)); //"Keyword"

Leave a Comment

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.