我以前在Java中使用过string.replaceAll(),但没有遇到任何麻烦,但是我很困惑这一点。我认为这只是工作,因为没有“/”或“$”字符。这是我想要做的:这个Java String.replaceAll()代码为什么不起作用?
String testString = "__constant float* windowArray";
String result = testString.replaceAll("__constant float* windowArray", "__global float* windowArray");
变量结果看起来和testString一样。我不明白为什么没有改变,请帮助。
哇。我越学习Java,就越喜欢C#。 – Crispy 2010-11-05 21:07:26
可能的[String.replaceAll反斜杠问题]的副本(http://stackoverflow.com/questions/1701839/backslash-problem-with-string-replaceall) – McDowell 2011-05-26 08:32:57