I'm trying to do something like this:
public String evaluateString(String s){
Pattern p = Pattern.compile("someregex");
Matcher m = p.matcher(s);
while(m.find()){
m.replaceCurrent(methodFoo(m.group()));
}
}
The problem is that there is no replaceCurrent method. Maybe there is an equivalent I overlooked. Basically I want to replace each match with the return value of a method called on that match. Any tips would be much appreciated!
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…