Libraryless. Click here for Pure Java version (3829L/22K).
1 | sS makePostData(Map map) { |
2 | new StringBuilder buf; |
3 | for (Map.Entry<O, O> e : castMapToMapO(map).entrySet()) { |
4 | S key = cast e.getKey(); |
5 | O val = e.getValue(); |
6 | if (val != null) { |
7 | S value = str(val); |
8 | if (nempty(buf)) buf.append("&"); |
9 | buf.append(urlencode(key)).append("=").append(urlencode(/*escapeMultichars*/(value))); |
10 | } |
11 | } |
12 | ret str(buf); |
13 | } |
14 | |
15 | sS makePostData(O... params) { |
16 | new StringBuilder buf; |
17 | int n = l(params); |
18 | for (int i = 0; i+1 < n; i += 2) { |
19 | S key = cast params[i]; |
20 | O val = params[i+1]; |
21 | if (val != null) { |
22 | S value = str(val); |
23 | if (nempty(buf)) buf.append("&"); |
24 | buf.append(urlencode(key)).append("=").append(urlencode(/*escapeMultichars*/(value))); |
25 | } |
26 | } |
27 | ret str(buf); |
28 | |
29 | } |
download show line numbers debug dex old transpilations
Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt, whxojlpjdney
No comments. add comment
Snippet ID: | #1001933 |
Snippet name: | makePostData |
Eternal ID of this version: | #1001933/4 |
Text MD5: | 53d2bbc38697893e2605c645df1ded79 |
Transpilation MD5: | ce18b3da542e804a68fd936faeb21b29 |
Author: | stefan |
Category: | |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2021-09-24 18:11:46 |
Source code size: | 785 bytes / 29 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 783 / 2371 |
Version history: | 3 change(s) |
Referenced in: | [show references] |