当前位置:网站首页>Url追加参数方法,考虑#、?、$的情况
Url追加参数方法,考虑#、?、$的情况
2022-06-28 11:38:00 【一杯苦芥】
public static String addParamToUrl(String url, String param) {
if (url.contains(param)) {
return url;
} else if (url.contains("?")) {
return url.contains("#") && url.indexOf("#") > url.indexOf("?") ? url.replaceFirst("#", "&" + param + "#") : url + "&" + param;
} else {
return url.contains("#") ? url.replaceFirst("#", "?" + param + "#") : url + "?" + param;
}
}边栏推荐
- Using soapUI to obtain freemaker's FTL file template
- Web3 security serials (3) | in depth disclosure of NFT fishing process and prevention techniques
- Day34 JS notes regular expression 2021.09.29
- Prefix and (one dimension)
- SoapUI rookie tutorial
- Day31 JS notes DOM 2021.09.26
- Intranet penetration in the working group environment: some basic methods
- 【C语言】结构体嵌套二级指针的使用
- day30 js笔记 BOM和DOM 2021.09.24
- MapReduce项目案例1
猜你喜欢

水果FL Studio/Cubase/Studio one音乐宿主软件对比

Convert black mask picture to color annotation file

Array method in JS 2021.09.18

Day33 JS note event (Part 2) September 28, 2021

day31 js笔记 DOM下 2021.09.26

Day32 JS note event (Part 1) September 27, 2021

Unity屏幕截图功能

How to deploy the software testing environment?

【C语言】二叉树的实现及三种遍历

Leetcode 705. 设计哈希集合
随机推荐
Ali three sides: what is the difference between using on or where in the left join associated table and the condition
MySQL cannot query the maximum value using the max function
AcWing 609. Salary (implemented in C language)
day24 js笔记 2021.09.15
What is DAPP system development and analytical understanding
Pre parsing, recursive functions and events in day25 JS 2021.09.16
JS foundation 10
Multi dimensional monitoring: the data base of intelligent monitoring
AcWing 607. Average 2 (implemented in C language)
Build your own website (18)
多维度监控:智能监控的数据基础
What method is required for word, PDF and txt files to realize full-text content retrieval?
day39 原型链及页面烟花效果 2021.10.13
Batch will png . bmp . JPEG format pictures are converted to Jpg format picture
1. print hourglass
IO stream of file and Base64
Three ways to implement LRU cache (recommended Collection)
Redis hash hash type string (5)
JS foundation 8
Chendanqi, Fang Fei, guquanquan and Li Bo won the prize, and the list of Sloan research award in 2022 was released