在Android中查找和替换字符串

在Android中查找和替换字符串,android,string,replace,Android,String,Replace,如何在Android中从上述字符串中删除“=\”ppshein\”?假设您有一个名为myString的字符串,并且希望删除所有出现的=“ppshein”的新字符串,请尝试 myString = "my name=\"ppshein\"" 可以通过以下方式删除字符串: myString.replace("=\"ppshein\"", ""); 首先,上面的字符串不会编译。您需要像这样编写:myString=“我的名字=\”ppshein\” 其次,使用:myString=myString.re

如何在Android中从上述字符串中删除“=\”ppshein\”

假设您有一个名为
myString
的字符串,并且希望删除所有出现的
=“ppshein”
的新字符串,请尝试

myString = "my name=\"ppshein\""

可以通过以下方式删除字符串:

myString.replace("=\"ppshein\"", "");

首先,上面的字符串不会编译。您需要像这样编写:
myString=“我的名字=\”ppshein\”

其次,使用:
myString=myString.replace(“=”ppshein\”,”)

字符串。将(“\”替换为“\ \”,”);
myString = myString.replaceAll("StringToReplace", "");
myString.replace("=\"ppshein\"", "");
string.replace("=\"ppshein\"", "");