Libraryless. Click here for Pure Java version (2750L/17K).
1 | sS addAnchorToURL(S url, S anchor) { |
2 | int i = smartIndexOf(url, '#'); |
3 | url = takeFirst(url, i); |
4 | if (nempty(anchor)) url += "#" + anchor; |
5 | ret url; |
6 | } |
download show line numbers debug dex old transpilations
Travelled to 5 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1029840 |
Snippet name: | addAnchorToURL - also removes/overwrites existing anchor |
Eternal ID of this version: | #1029840/3 |
Text MD5: | 0d181c3114e527f9c85eac808c818cd8 |
Transpilation MD5: | ef240b0db8fc54b3f3f26ce01e1ea282 |
Author: | stefan |
Category: | javax / html |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2020-09-21 15:25:31 |
Source code size: | 158 bytes / 6 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 286 / 375 |
Version history: | 2 change(s) |
Referenced in: | [show references] |