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

22
LINES

< > BotCompany Repo | #1005228 // Load "I can eat glass" phrase in many languages [dev., utf encoding problem]

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

Libraryless. Click here for Pure Java version (2681L/18K/60K).

!752

sbool live = false;

p {
  S html = live ? loadPage_utf8("http://kermitproject.org/utf8.html") : loadNTSnippet("#3000405");
  print(html);
  L<S> tok = htmlTok(html);
  print("ol: " + tok.indexOf("<ol>"));
  print("ol end: " + tok.indexOf("</ol>"));
  L<L<S>> ols = findContainerTag(html, "ol");
  L<S> ol = unwrapContainerTag(first(ols));
  psl(ol);
  int i = 0;
  while ((i = indexOf(ol, "<b>", i+1)) >= 0) {
    int j = indexOf(ol, "</b>", i);
    if (j < 0) break;
    S language = join(subList(ol, i+1, j));
    print("Language: " + language);
    i = j;
  }
}

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1005228
Snippet name: Load "I can eat glass" phrase in many languages [dev., utf encoding problem]
Eternal ID of this version: #1005228/1
Text MD5: ebf25964299f0307d6a308ec49589178
Transpilation MD5: aac4ca7b4e9f91dfead34bad5e0678fa
Author: stefan
Category: javax / web scraping
Type: JavaX source code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2016-10-25 18:01:50
Source code size: 592 bytes / 22 lines
Pitched / IR pitched: No / No
Views / Downloads: 455 / 518
Referenced in: [show references]