Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

6
LINES

< > BotCompany Repo | #1029840 // addAnchorToURL - also removes/overwrites existing anchor

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (2750L/17K).

sS addAnchorToURL(S url, S anchor) {
  int i = smartIndexOf(url, '#');
  url = takeFirst(url, i);
  if (nempty(anchor)) url += "#" + anchor;
  ret url;
}

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: 285 / 373
Version history: 2 change(s)
Referenced in: [show references]