Libraryless. Click here for Pure Java version (11438L/64K).
// jreplace_multi goes over ins/outs once (doesn't loop) sbool jreplace_multi(LS tok, LS ins, S out) { bool change = false; for (S in : ins) if (jreplace(tok, in, out)) change = true; ret change; } sS jreplace_multi(S s, S... replacements) { if (empty(replacements)) ret s; LS tok = javaTok(s); bool change; for (int i = 0; i < l(replacements); i += 2) if (jreplace(tok, replacements[i], replacements[i+1])) set change; ret change ? join(tok) : s; } static LS jreplace_multi(LS tok, S... replacements) { for (int i = 0; i < l(replacements); i += 2) jreplace(tok, replacements[i], replacements[i+1]); ret tok; }
download show line numbers debug dex old transpilations
Travelled to 8 computer(s): bhatertpkbcr, cfunsshuasjs, gwrvuhgaqvyk, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1020948 |
Snippet name: | jreplace_multi |
Eternal ID of this version: | #1020948/7 |
Text MD5: | fd4258552d24ad9fcc1907f3f77f277f |
Transpilation MD5: | 8da3bc7e683dc85440ec7d6a24ae9bf1 |
Author: | stefan |
Category: | javax / transpiling |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2023-09-17 20:39:41 |
Source code size: | 681 bytes / 25 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 421 / 561 |
Version history: | 6 change(s) |
Referenced in: | [show references] |