import java.util.regex.Matcher;
import java.util.regex.Pattern;
@SuppressWarnings("all")
public class Run1 {
public static void main(String[] args) {
Pattern p = Pattern.compile("john");
Matcher m = p.matcher("john does this , and john does that");
String str = m.replaceFirst("sam");
System.out.println(str);
}
}
replaceFirst的例子
最新推荐文章于 2024-07-03 16:59:13 发布