Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

24
LINES

< > BotCompany Repo | #1001149 // Rename bot

JavaX source code [tags: use-pretranspiled] - run with: x30.jar

Libraryless. Click here for Pure Java version (486L/4K/11K).

!747

m {
  p {
    S s = smartJoin(args);
    print(s);
    new Matches m;
    int renames = 0;
    if (match3("rename * to * in *", s, m)) {
      S in = unquote(m.m[0]), out = unquote(m.m[1]), f = unquote(m.m[2]);
      print("Renaming " + quote(in) + " to " + quote(out) + " in " + f);
      L<S> tok = javaTok(loadTextFile(f));
      for (int i = 1; i < tok.size(); i += 2) {
        if (tok.get(i).equals(in)) {
          tok.set(i, out);
          ++renames;
        }
      }
      saveTextFile(f, join(tok));
      print("Done, " + renames + " rename(s).");
    } else
      print("?");
  }
}

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: 613 / 712
Referenced in: #3000202 - Answer for stefanreich (>> T conversion bot)
#3000238 - Answer for stefanreich (>> t power bot)
#3000382 - Answer for ferdie (>> t = 1, f = 0)
#3000383 - Answer for funkoverflow (>> t=1, f=0 okay)