Libraryless. Click here for Pure Java version (3342L/18K).
sS addDefaultProtocolToURL(S protocol, S url) { if (empty(url)) ret url; if (regexpFindIC("^[a-z]+://", url)) ret url; protocol = dropSuffix(":", dropSuffix("//", protocol)); ret protocol + ":" + addPrefix("//", url); }
download show line numbers debug dex old transpilations
Travelled to 4 computer(s): bhatertpkbcr, mowyntqkapby, mqqgnosmbjvj, pyentgdyhuwx
No comments. add comment
Snippet ID: | #1032379 |
Snippet name: | addDefaultProtocolToURL |
Eternal ID of this version: | #1032379/5 |
Text MD5: | 84b82ea1749cc41f7118f9e8963c4801 |
Transpilation MD5: | 3cba2c0a6c993b83d0ee3a285d9c8fc3 |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2021-09-02 02:51:37 |
Source code size: | 232 bytes / 6 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 155 / 222 |
Version history: | 4 change(s) |
Referenced in: | #1006654 - Standard functions list 2 (LIVE, continuation of #761) |