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).

1  
// tok should be the output of htmlcoarsetok
2  
static L<S> dropAllTags(L<S> tok) {
3  
  new L<S> list;
4  
  for i over tok: {
5  
    S t = tok.get(i);
6  
    if (odd(i) && t.startsWith("<")) {
7  
      list.set(list.size()-1, list.get(list.size()-1) + tok.get(i+1));
8  
      ++i;
9  
    } else
10  
      list.add(t);
11  
  }
12  
  return list;
13  
}
14  
15  
// alternatively, call this convenient function
16  
static S dropAllTags(S html) {
17  
  if (!contains(html, '<')) ret html;
18  
  return join(dropAllTags(htmlcoarsetok(html)));
19  
}

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: 726 / 1493
Version history: 3 change(s)
Referenced in: [show references]