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

8
LINES

< > BotCompany Repo | #1034156 // charIndexToCharInToken

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

Libraryless. Click here for Pure Java version (4766L/26K).

1  
static CharInToken charIndexToCharInToken(LS tok, int charIndex) {
2  
  int i = 0, idx = 0, lTok;
3  
  while (i < l(tok) && idx+(lTok = l(tok.get(i))) <= charIndex) {
4  
    idx += lTok;
5  
    i++;
6  
  }
7  
  ret CharInToken(tok, i, charIndex-idx);
8  
}

Author comment

Began life as a copy of #1008633

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1034156
Snippet name: charIndexToCharInToken
Eternal ID of this version: #1034156/2
Text MD5: e6487a44be1d78b7ab3f4ac8d04d5ab2
Transpilation MD5: 24d820d5171b6cc6ebd4f8b8a1465261
Author: stefan
Category: javax / parsing
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-01-24 19:10:55
Source code size: 241 bytes / 8 lines
Pitched / IR pitched: No / No
Views / Downloads: 143 / 214
Version history: 1 change(s)
Referenced in: [show references]