. titlesource: --> getHTMLComments - returns them without the enclosing <!-- and --> [1028644]

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

17
LINES

< > BotCompany Repo | #1028644 // getHTMLComments - returns them without the enclosing <!-- and -->

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

Libraryless. Click here for Pure Java version (2586L/16K).

static LS getHTMLComments(S html) {
  ret getHTMLComments(htmlTok(html));
}

static LS getHTMLComments(LS tok) {
  new LS l;
  for (int idx = 0; idx < l(tok); idx += 2) {
    S t = tok.get(idx);
    int i = 0;
    while ((i = indexOf(t, "<!--", i)) >= 0) {
      int j = smartIndexOf(t, "-->", i+4);
      l.add(substring(t, i+4, j));
      i = j+3;
    }
  }
  ret l;
}

Author comment

Began life as a copy of #1008452

download  show line numbers  debug dex  old transpilations   

Travelled to 7 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv

No comments. add comment

Snippet ID: #1028644
Snippet name: getHTMLComments - returns them without the enclosing <!-- and -->
Eternal ID of this version: #1028644/4
Text MD5: eb2c2ac73b7d2202999fec2d4d394b73
Transpilation MD5: 859b9e098aef8530ab8750ab75274b94
Author: stefan
Category: javax / html parsing
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-07-01 11:56:56
Source code size: 386 bytes / 17 lines
Pitched / IR pitched: No / No
Views / Downloads: 134 / 222
Version history: 3 change(s)
Referenced in: [show references]