Libraryless. Click here for Pure Java version (10794L/60K).
// f : Matcher -> S sS regexReplace(S s, S pat, O f) { ret regexReplace(regexpMatcher(pat, s), f); } sS regexReplace(S s, S pat, S replacement) { ret regexpReplace_direct(s, pat, replacement); } sS regexReplace(Matcher m, O f) { new StringBuffer buf; while (m.find()) m.appendReplacement(buf, m.quoteReplacement(str(callF(f, m)))); m.appendTail(buf); ret str(buf); } sS regexReplace(S s, S pat, IF1<Matcher, S> f) { ret regexReplace(s, pat, (O) f); }
Began life as a copy of #1005236
download show line numbers debug dex old transpilations
Travelled to 15 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, jtubtzbbkimh, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1005237 |
Snippet name: | regexReplace - with function callback or string replacement |
Eternal ID of this version: | #1005237/10 |
Text MD5: | f61b3019966de7a581f6f7cc63a88fea |
Transpilation MD5: | 5ce87030482a00f3d01322e1e684e54c |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2024-10-19 22:11:03 |
Source code size: | 490 bytes / 20 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 579 / 717 |
Version history: | 9 change(s) |
Referenced in: | #1006654 - Standard functions list 2 (LIVE, continuation of #761) #1014194 - regexpReplace - syonym of regexReplace + regexpReplace_direct #1018263 - regexpReplaceIC_direct - with direct replacement #1018590 - regexReplaceIC - with function callback |