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

14
LINES

< > BotCompany Repo | #1026466 // findEndOfBracketPart_strict [dev.]

JavaX fragment (include)

1  
// i must point at the opening bracket (any of the 2 types, not type parameters)
2  
// index returned is index of closing bracket + 1
3  
static int findEndOfBracketPart_strict(List<String> cnc, int i) {
4  
  int j = i+2;
5  
  LS open = ll(cnc.get(i));
6  
  while (j < cnc.size()) {
7  
    if (eqOneOf(cnc.get(j), "{", "(")) ++level;
8  
    else if (eqOneOf(cnc.get(j), "}", ")")) --level;
9  
    if (level == 0)
10  
      return j+1;
11  
    ++j;
12  
  }
13  
  return cnc.size();
14  
}

Author comment

Began life as a copy of #1001165

download  show line numbers  debug dex  old transpilations   

Travelled to 7 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv

No comments. add comment

Snippet ID: #1026466
Snippet name: findEndOfBracketPart_strict [dev.]
Eternal ID of this version: #1026466/1
Text MD5: 803a4e0ecc81a1c894270978c5402c84
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-01-05 01:35:33
Source code size: 454 bytes / 14 lines
Pitched / IR pitched: No / No
Views / Downloads: 160 / 189
Referenced in: [show references]