12
LINES
< > BotCompany Repo | #2000458
// Short syntax for dynamic replace in Java(X)
New Tinybrain snippet
1 | Full:
|
2 |
|
3 | Matcher m = Pattern.compile("(#\\d+)").matcher(text);
|
4 | new StringBuffer buf; // cool "quicknew" syntax!
|
5 | while (m.find())
|
6 | m.appendReplacement(buf, m.quoteReplacement(formatSnippetRef(m.group())));
|
7 | m.appendTail(buf);
|
8 | text = buf.toString();
|
9 |
|
10 | Short:
|
11 |
|
12 | text = text.replaceAll("(#\\d+)", m -> formatSnippetRef(m.group())); |
download show line numbers
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 |
add comment
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: |
919 / 181 |
Referenced in: |
[show references] |