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)

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

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