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

19
LINES

< > BotCompany Repo | #1008740 // Simplify ipToCountry.csv

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

Libraryless. Click here for Pure Java version (1566L/11K/37K).

!7

p {
  File in = new File("/home/stefan/dev/ip-to-country.csv");
  long last = 0;
  new StringBuilder buf;
  for (S s : linesFromReader(utf8BufferedReader(in))) {
    L<S> l = tok_splitAtComma_unquote(s);
    if (l(l) < 3) continue;
    long start = ipToInt(first(l));
    S country = last(l);
    S line = (start-last) + " " + country;
    print(line);
    buf.append(line + "\n");
    last = start;
  }
  File out = new File(f2s(in) + ".short.gz");
  saveGZTextFile(out, str(buf));
}

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: #1008740
Snippet name: Simplify ipToCountry.csv
Eternal ID of this version: #1008740/4
Text MD5: 890070c3820a101f71a0f258685b6c16
Transpilation MD5: 360dff04d904b4e6022c2569a26f8c6a
Author: stefan
Category: javax
Type: JavaX source code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-05-31 13:38:32
Source code size: 506 bytes / 19 lines
Pitched / IR pitched: No / No
Views / Downloads: 474 / 625
Version history: 3 change(s)
Referenced in: [show references]