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

15
LINES

< > BotCompany Repo | #1003991 // findEndOfContainerTag

JavaX fragment (include)

1  
// i = index of opening tag
2  
// returns index of closing tag + 1 (or -1 if no closing tag found)
3  
static int findEndOfContainerTag(L<S> tok, int i) {
4  
  S tag = getTag(tok.get(i));
5  
  int j, level = 1;
6  
  for (j = i+2; j < tok.size(); j += 2)
7  
    if (isTag(tok.get(j), tag))
8  
      ++level;
9  
    else if (isTag(tok.get(j), "/" + tag)) {
10  
      --level;
11  
      if (level == 0)
12  
        ret j+1;
13  
    }
14  
  ret -1;
15  
}

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: 552 / 566
Referenced in: [show references]