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

15
LINES

< > BotCompany Repo | #1003991 // findEndOfContainerTag

JavaX fragment (include)

// i = index of opening tag
// returns index of closing tag + 1 (or -1 if no closing tag found)
static int findEndOfContainerTag(L<S> tok, int i) {
  S tag = getTag(tok.get(i));
  int j, level = 1;
  for (j = i+2; j < tok.size(); j += 2)
    if (isTag(tok.get(j), tag))
      ++level;
    else if (isTag(tok.get(j), "/" + tag)) {
      --level;
      if (level == 0)
        ret j+1;
    }
  ret -1;
}

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: #1003991
Snippet name: findEndOfContainerTag
Eternal ID of this version: #1003991/1
Text MD5: eab85a5da8aa329ed4e2e76b6bd0aefd
Author: stefan
Category: javax / html
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2016-08-01 22:32:30
Source code size: 415 bytes / 15 lines
Pitched / IR pitched: No / No
Views / Downloads: 477 / 487
Referenced in: [show references]