java String 字符串替换,replace成功,replaceAll却失败?求原因...
Stringabc="asdfsadf$[姓名]";abc=abc.replace("$[姓名]","张三");System.out.println(abc);-----...
String abc = "asdfsadf$[姓名]";
abc = abc.replace("$[姓名]", "张三");
System.out.println(abc); -------------> 成功替换 结果:asdfsadf张三
---------------------------------------------------------
String abc = "asdfsadf$[姓名]";
abc = abc.replaceAll("$[姓名]", "张三");
System.out.println(abc); -------------> 替换失败 结果asdfsadf$[姓名] 展开
abc = abc.replace("$[姓名]", "张三");
System.out.println(abc); -------------> 成功替换 结果:asdfsadf张三
---------------------------------------------------------
String abc = "asdfsadf$[姓名]";
abc = abc.replaceAll("$[姓名]", "张三");
System.out.println(abc); -------------> 替换失败 结果asdfsadf$[姓名] 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询