Neighborhoods a regular expression (replaceall ())

Category: Java SE
 
lsf880611
2012-11-18 06:42:00

Sponsored Links
String s1 = "User ID: $ {id} name: $ {name}"
I want to use replaceall ()
the $ {id} becomes 001, $ {name} variable zhang

how to write replaceall () parameters?

Sponsored Links

bamboo237
2012-11-18 06:52:11
String s1 = "User ID: $ {id} name: $ {name}";
System.out.println (s1.replaceAll ("\ \ $ \ \ {id \ \}", "001"). replaceAll ("\ \ $ \ \ {name \ \}" ;, "zhang"));
ilmob
2012-11-18 06:59:42
String s1 = "User ID: $ {id} name: $ {name}";
s1 = s1.replaceAll ("\ \ $ \ \ {id \ \}", "001"). replaceAll ("\ \ $ \ \ {name \ \}", " ; zhang ");
System.out.println (s1);
wai2014kuaile
2012-11-18 07:18:36
s1.replaceAll (" \ \ $ \ \ {id \ \} "," 001 " ). replaceAll ("\ \ $ \ \ {name \ \}", "zhang")
Domain and server ip had changed since 8/23/2013. Suspend the user registration and posts for program maintenance.