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

16
LINES

< > BotCompany Repo | #627 // A lookup database handler (developing)

JavaX source code - run with: x30.jar

main {
  psvm {
    String[] db = toLines(loadTextFile("input/database.txt"));
    MultiMap<String, String> examples = new MultiMap<String, String>();
    for (String s : db) {
      int i = s.indexOf(" is an "), j = s.indexOf(" is a "), k;
      if (i >= 0) k = i+7;
      else if (j >= 0) k = i+6;
      else { System.out.println("Warning"); continue; }
      String a = s.substring(0, i).trim(), b = s.substring(k).trim();
      examples.put(b, a);
    }

    // TODO: lookup entry
  }
}

download  show line numbers  debug dex  old transpilations   

Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #627
Snippet name: A lookup database handler (developing)
Eternal ID of this version: #627/1
Text MD5: 6251d2e197ed70b2a4cffe554eacd36b
Author: stefan
Category: javax
Type: JavaX source code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2015-06-19 20:53:01
Source code size: 505 bytes / 16 lines
Pitched / IR pitched: No / Yes
Views / Downloads: 698 / 573
Referenced in: [show references]