static S jreplace_first(S s, S in, S out) { ret jreplace_first(s, in, out, null); } static S jreplace_first(S s, S in, S out, O condition) { L<S> tok = javaTok(s); ret jreplace_first(tok, in, out, false, false, condition) ? join(tok) : s; } // leaves tok properly tokenized // returns true iff anything was replaced static boolean jreplace_first(L<S> tok, S in, S out) { ret jreplace_first(tok, in, out, false, true, null); } static boolean jreplace_first(L<S> tok, S in, S out, O condition) { ret jreplace_first(tok, in, out, false, true, condition); } static boolean jreplace_first(L<S> tok, S in, S out, boolean ignoreCase, boolean reTok, O condition) { L<S> tokin = javaTok(in); jfind_preprocess(tokin); boolean anyChange = false; int i = 1; if ((i = findCodeTokens(tok, i, ignoreCase, toStringArray(codeTokensOnly(tokin)), condition)) >= 0) { L<S> subList = tok.subList(i-1, i+l(tokin)-1); // N to N S expansion = jreplaceExpandRefs(out, subList); int end = i+l(tokin)-2; clearAllTokens(tok, i, end); // C to C tok.set(i, expansion); if (reTok) reTok(tok, i, end); anyChange = true; } ret anyChange; } static bool jreplace_first_debug;
Began life as a copy of #1004948
download show line numbers debug dex old transpilations
Travelled to 12 computer(s): bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1019424 |
Snippet name: | jreplace_first - replace only once |
Eternal ID of this version: | #1019424/1 |
Text MD5: | 0afcd7c4c8ead0f7e453751f89b15df1 |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2018-11-06 18:06:15 |
Source code size: | 1242 bytes / 39 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 334 / 362 |
Referenced in: | [show references] |