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

10
LINES

< > BotCompany Repo | #1008878 - indexOfClosingCurlyBracket

JavaX fragment (include)

static int indexOfClosingCurlyBracket(L<S> lines, int opening) {
  int level = 0;
  for (int i = opening; i < l(lines); i++) {
    L<S> tok = javaTokC(lines.get(i));
    level += countOccurrences(tok, "{");
    level -= countOccurrences(tok, "}");
    if (level <= 0) ret i;
  }
  ret l(lines);
}

download  show line numbers  debug dex   

Travelled to 9 computer(s): aoiabmzegqzx, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, tslmcundralx, tvejysmllsmz

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

Formerly at http://tinybrain.de/1008878 & http://1008878.tinybrain.de