开发者

hi I want the code for &b=52&f=norefer and &b=52 [duplicate]

This question already has answers here: Closed 12 years ago.

Possible Duplicate:

I want the 开发者_运维百科pattern for removing the &b=128&f=norefer from following url

http://www.yahoo.com/url/5f&b=52&f=norefer 
http://www.yahoo.com/url/6aa82d?show=all&page=2&b=52 

String finalUrl =decodedUrl.replace("&b=52","");
page.setPageUrl(finalUrl);

I want to remove &b=52&f=norefer from the first url and &b=52 and from the second url which pattern i will use please give me the code without hard-coded value.


url.replaceFirst("&b=.*", ""); will remove the tail of the string starting from "&b=". I hope it is good enough for you. At least it is OK for your two exampels and is not sensitive to value of parameter b.

If it is not enough try to describe your task more specifically or just learn a little bit regular expressions.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜