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

1  
main {
2  
  psvm {
3  
    String[] db = toLines(loadTextFile("input/database.txt"));
4  
    MultiMap<String, String> examples = new MultiMap<String, String>();
5  
    for (String s : db) {
6  
      int i = s.indexOf(" is an "), j = s.indexOf(" is a "), k;
7  
      if (i >= 0) k = i+7;
8  
      else if (j >= 0) k = i+6;
9  
      else { System.out.println("Warning"); continue; }
10  
      String a = s.substring(0, i).trim(), b = s.substring(k).trim();
11  
      examples.put(b, a);
12  
    }
13  
14  
    // TODO: lookup entry
15  
  }
16  
}

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: 701 / 576
Referenced in: [show references]