Full: Matcher m = Pattern.compile("(#\\d+)").matcher(text); new StringBuffer buf; // cool "quicknew" syntax! while (m.find()) m.appendReplacement(buf, m.quoteReplacement(formatSnippetRef(m.group()))); m.appendTail(buf); text = buf.toString(); Short: text = text.replaceAll("(#\\d+)", m -> formatSnippetRef(m.group()));
Snippet is not live.
Travelled to 12 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
ID | Author/Program | Comment | Date |
---|---|---|---|
78 | stefan | Now we just need a translator... | 2015-07-25 14:00:03 |
Snippet ID: | #2000458 |
Snippet name: | Short syntax for dynamic replace in Java(X) |
Eternal ID of this version: | #2000458/1 |
Text MD5: | f14c46b93879e5a2f24141b8bd01905d |
Author: | stefan |
Category: | |
Type: | New Tinybrain snippet |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2015-07-25 13:46:04 |
Source code size: | 365 bytes / 12 lines |
Pitched / IR pitched: | No / Yes |
Views / Downloads: | 916 / 180 |
Referenced in: | [show references] |