Libraryless. Click here for Pure Java version (486L/4K/11K).
1 | !747 |
2 | |
3 | m {
|
4 | p {
|
5 | S s = smartJoin(args); |
6 | print(s); |
7 | new Matches m; |
8 | int renames = 0; |
9 | if (match3("rename * to * in *", s, m)) {
|
10 | S in = unquote(m.m[0]), out = unquote(m.m[1]), f = unquote(m.m[2]); |
11 | print("Renaming " + quote(in) + " to " + quote(out) + " in " + f);
|
12 | L<S> tok = javaTok(loadTextFile(f)); |
13 | for (int i = 1; i < tok.size(); i += 2) {
|
14 | if (tok.get(i).equals(in)) {
|
15 | tok.set(i, out); |
16 | ++renames; |
17 | } |
18 | } |
19 | saveTextFile(f, join(tok)); |
20 | print("Done, " + renames + " rename(s).");
|
21 | } else |
22 | print("?");
|
23 | } |
24 | } |
download show line numbers debug dex old transpilations
Travelled to 15 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, teubizvjbppd, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
| Snippet ID: | #1001149 |
| Snippet name: | Rename bot |
| Eternal ID of this version: | #1001149/1 |
| Text MD5: | 2386d29ab8c6528a76aa2ee0bced138c |
| Transpilation MD5: | 6832caf571252602e100335a65dc8625 |
| Author: | stefan |
| Category: | javax |
| Type: | JavaX source code |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2015-09-24 18:43:14 |
| Source code size: | 624 bytes / 24 lines |
| Pitched / IR pitched: | No / Yes |
| Views / Downloads: | 843 / 976 |
| Referenced in: | [show references] |