日期:2014-05-20 浏览次数:20763 次
public class tihuan {
public static void main(String[] args){
String s="<string name=\"STR_ABC\">ABC</string>";
System.out.println(s.replaceAll("(<.*>)ABC(<.*>)","$1hello$2" ));
}
}
String s = "<string name=\"STR_ABC\">ABC</string>";
System.out.println(s.replace(">ABC<", ">hello<"));
public class tihuan {
public static void main(String[] args) {
String s = "<string name=\"STR_ABC\">ABC</string>";
System.out.println(s.replaceAll("(?<=>)\\w+(?=<)", "hello"));
}
}