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

19
LINES

< > BotCompany Repo | #1000892 // dropAllTags

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Compilation Failed (3935L/23K).

// tok should be the output of htmlcoarsetok
static L<S> dropAllTags(L<S> tok) {
  new L<S> list;
  for i over tok: {
    S t = tok.get(i);
    if (odd(i) && t.startsWith("<")) {
      list.set(list.size()-1, list.get(list.size()-1) + tok.get(i+1));
      ++i;
    } else
      list.add(t);
  }
  return list;
}

// alternatively, call this convenient function
static S dropAllTags(S html) {
  if (!contains(html, '<')) ret html;
  return join(dropAllTags(htmlcoarsetok(html)));
}

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1000892
Snippet name: dropAllTags
Eternal ID of this version: #1000892/4
Text MD5: ac8f70af8e610a363afabd4d45250173
Transpilation MD5: 19598d1308fb220655d216c3d8f2b753
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-10-10 23:43:52
Source code size: 498 bytes / 19 lines
Pitched / IR pitched: No / No
Views / Downloads: 779 / 1558
Version history: 3 change(s)
Referenced in: [show references]