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

12
LINES

< > BotCompany Repo | #1013971 // appendQueryToURL - breaking change: process # properly

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

Libraryless. Click here for Pure Java version (3318L/18K).

static S appendQueryToURL(S url, Map params) {
  if (url == null) null;
  S data = makePostData(params);
  if (empty(data)) ret url;
  int idx = smartIndexOf(url, '#');
  S url2 = takeFirst(url, idx);
  ret url2 + (url2.contains("?") ? "&" : "?") + data + substring(url, idx);
}

static S appendQueryToURL(S url, O... data) {
  ret appendQueryToURL(url, paramsToMap(data));
}

Author comment

Began life as a copy of #1002141

download  show line numbers  debug dex  old transpilations   

Travelled to 16 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ekrmjmnbrukm, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mowyntqkapby, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv

No comments. add comment

Snippet ID: #1013971
Snippet name: appendQueryToURL - breaking change: process # properly
Eternal ID of this version: #1013971/9
Text MD5: 155d698f8b383964ea0c7b99eb16ab39
Transpilation MD5: c786483f7e7b1a5adc91707707c0c737
Author: stefan
Category:
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-08-27 09:19:43
Source code size: 386 bytes / 12 lines
Pitched / IR pitched: No / No
Views / Downloads: 548 / 676
Version history: 8 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)
#1030917 - appendQueryToURL [backup]