if(containsAllWeather || containsAllWeather2){
String weatherLocation = value.toString();
if (weatherLocation != null){
weatherLocation.replaceAll("how","")
.replaceAll("what","")
.replaceAll("weather", "")
.replaceAll("like", "")
.replaceAll(" in", "")
.replaceAll(" at", "")
.replaceAll("around", "");
}
weatherLocation 仍然准确地给出了变量值包含的内容,并且不会删除上面列出的任何单词。
当我将weatherLocation拆分为一个字符串数组(例如weatherLoc数组)并且这些代码行适用于weatherLoc [1]时,这很有效
我究竟做错了什么?