我有一个文件,我将该文件转换为字符串。现在,每当我试图用像“foobar”这样的小写数据替换一些像“fooBar”这样的驼峰数据时,它就不起作用了。
我试过这两种情况。
String target = "fooBar and tooohh";
target = target.replace("foobar", "");
System.out.println(target);
它给了我这个输出fooBar and tooohh
然后我尝试了这个
String target123 = "fooBar and tooohh";
target123=target123.replace("(?i)foobar", "") ;
System.out.println(target123);
这也给了我相同的输出:-fooBar and tooohh