日期:2014-05-17 浏览次数:20754 次
public static void main(String[] args) {
String str = "我和${1}去打${2} ";
str = str.replaceAll("\\$\\{(\\d+)\\}", "#p_$1#");
System.out.println(str);
}
public static void main(String[] args) {
String str = "我和#p_1#去打#p_2#";
str = str.replaceAll("#p_(\\d+)#", "\\$\\{$1\\}");
System.out.println(str);
}