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

14
LINES

< > BotCompany Repo | #1030276 // findHTMLTagWithClassDeep - HTML parsing, filter by class

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

Libraryless. Click here for Pure Java version (4706L/31K).

// tok must come from htmlTok
// returns all container tags found (including content) as CNC
// honors nested tags correctly
static LLS mapMethodLike findHTMLTagWithClassDeep(S className, LS tok) {
  new LLS l;
  int i = 1;
  for (i = 1; i < l(tok); i += 2) {
    if (cic(splitAtSpace_trim(tagParam(tok.get(i), "class")), className)) {
      int j = findClosingTag(tok, i);
      l.add(subList(tok, i-1, j+2));
    }
  }
  ret l;
}

Author comment

Began life as a copy of #1008450

download  show line numbers  debug dex  old transpilations   

Travelled to 4 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, vouqrxazstgt

No comments. add comment

Snippet ID: #1030276
Snippet name: findHTMLTagWithClassDeep - HTML parsing, filter by class
Eternal ID of this version: #1030276/5
Text MD5: d4383acd0a71d086d606ea31bc1d524e
Transpilation MD5: 2a3f5e6176dd80810225d1dd6afcb669
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-11-25 14:20:39
Source code size: 444 bytes / 14 lines
Pitched / IR pitched: No / No
Views / Downloads: 237 / 327
Version history: 4 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)