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

10
LINES

< > BotCompany Repo | #1008878 // indexOfClosingCurlyBracket

JavaX fragment (include)

1  
static int indexOfClosingCurlyBracket(L<S> lines, int opening) {
2  
  int level = 0;
3  
  for (int i = opening; i < l(lines); i++) {
4  
    L<S> tok = javaTokC(lines.get(i));
5  
    level += countOccurrences(tok, "{");
6  
    level -= countOccurrences(tok, "}");
7  
    if (level <= 0) ret i;
8  
  }
9  
  ret l(lines);
10  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1008878
Snippet name: indexOfClosingCurlyBracket
Eternal ID of this version: #1008878/1
Text MD5: 56d4631aa33bebc5ce1b55c0b4a27fe4
Author: stefan
Category: javax / a.i.
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-06-15 17:49:27
Source code size: 305 bytes / 10 lines
Pitched / IR pitched: No / No
Views / Downloads: 604 / 642
Referenced in: [show references]