当前位置:网站首页>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;
}
}边栏推荐
- 赛尔号抽奖模拟求期望
- 6.A-B
- Redis principle - List
- Cannot redeclare block range variables
- Day28 strict mode, string JS 2021.09.22
- Contract quantitative trading system development | contract quantitative app development (ready-made cases)
- 【sciter】: sciter-fs模块扫描文件API的使用及其注意细节
- 来吧元宇宙,果然这热度一时半会儿过不去了
- Difference (one dimension)
- The default point of this in JS and how to modify it to 2021.11.09
猜你喜欢

Convert black mask picture to color annotation file

Web3安全连载(3) | 深入揭秘NFT钓鱼流程及防范技巧

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

day33 js笔记 事件(下)2021.09.28

Is it feasible to be a programmer at the age of 26?

QML控件类型:TabBar

Unity屏幕截图功能

day32 js笔记 事件(上)2021.09.27

多维度监控:智能监控的数据基础

New listing of operation light 3.0 - a sincere work of self subversion across the times!
随机推荐
6. calculation index
MapReduce project case 1
纯纯大怨种!那些年被劝退的考研专业
Random forest and poetry maker trained by AMR
Build your own website (18)
Remote login sshd service
【C语言】关于scanf()与scanf_s()的一些问题
Day28 strict mode, string JS 2021.09.22
來吧元宇宙,果然這熱度一時半會兒過不去了
Day31 JS notes DOM 2021.09.26
水果FL Studio/Cubase/Studio one音乐宿主软件对比
Oracle date format exception: invalid number
Open3d manual clipping point cloud
QML control type: tabbar
Redis 原理 - List
NFT card chain game system development DAPP construction technical details
Data analysis learning notes
Daily practice of C language - day 4: find the sum of all even numbers within 100
The default point of this in JS and how to modify it to 2021.11.09
【C语言】如何很好的实现复数类型