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

8
LINES

< > BotCompany Repo | #1008633 // charToTokenIndex_left

JavaX fragment (include)

static int charToTokenIndex_left(L<S> tok, int charIndex) {
  int i = 0, idx = 0;
  while (i < l(tok) && idx+l(tok.get(i)) <= charIndex) {
    idx += l(tok.get(i));
    i++;
  }
  ret i;
}

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: #1008633
Snippet name: charToTokenIndex_left
Eternal ID of this version: #1008633/4
Text MD5: 3744ee93e8f43c408d92447ff1fae9ff
Author: stefan
Category: javax / parsing
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-05-26 16:23:23
Source code size: 195 bytes / 8 lines
Pitched / IR pitched: No / No
Views / Downloads: 466 / 517
Version history: 3 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)
#1008634 - charToTokenIndex_right
#1008636 - tokenToCharIndex
#1034156 - charIndexToCharInToken