如何在URL Java中删除参数 [英] How to remove the parameters in url Java

查看:704
本文介绍了如何在URL Java中删除参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在运行项目时有一个URL.

I have a URL when I run my project.

http://localhost:8084/blog1_1/title?uname = 55%22

,我想从该网址中删除查询字符串,如下所示:

and I want remove the query string from this URL like below:

http://localhost:8084/blog1_1/title

您能建议我该怎么做吗?

Can you please suggest me how to do this?

推荐答案

String url="http://localhost:8084/blog1_1/title?uname=55%22";
String onlyUrl=url.substring(0,url.lastIndexOf("?")); //this has the URL

这篇关于如何在URL Java中删除参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆