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

15
LINES

< > BotCompany Repo | #1032850 // tok_findEndOfAngleBracketPart

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (3804L/22K).

// i must point at the opening bracket (<)
// index returned is index of closing bracket (>)
// If there is NO opening bracket at i, we return nothing
static int tok_findEndOfAngleBracketPart(LS tok, int i) {
  int level = 0, n = l(tok);
  while ping (i < n) {
    S t = tok.get(i);
    if (eq(t, "<")) ++level;
    if (level < 1) ret i-2;
    if (eq(t, ">")) --level;
    if (level < 1) ret i;
    i += 2;
  }
  ret n;
}

Author comment

Began life as a copy of #1017794

download  show line numbers  debug dex  old transpilations   

Travelled to 3 computer(s): bhatertpkbcr, mowyntqkapby, mqqgnosmbjvj

No comments. add comment

Snippet ID: #1032850
Snippet name: tok_findEndOfAngleBracketPart
Eternal ID of this version: #1032850/9
Text MD5: f6522690c481f3c3834e4d4b0abcd2be
Transpilation MD5: 374942ab486a41c003ae37e15ee7ca5f
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-10-06 21:09:50
Source code size: 435 bytes / 15 lines
Pitched / IR pitched: No / No
Views / Downloads: 171 / 227
Version history: 8 change(s)
Referenced in: [show references]