I want the pattern for removing the &b=128&f=norefer from following url

后端 未结 3 1904
遇见更好的自我
遇见更好的自我 2020-12-22 11:45

http://www.yahoo.com &b=128&f=norefer

I want to remove &b=128&f=norefer

String finalUrl =decodedUrl.repl         


        
3条回答
  •  长情又很酷
    2020-12-22 12:29

    Is the reason for not wanting a hardcoded string that you wish to be able to remove some other string as well? Then you could consider writing a method like:

    public String removeNoise(String url, String noisePattern) {
        return url.replace(noisePattern, "");
    }
    

提交回复
热议问题