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).

static CharInToken charIndexToCharInToken(LS tok, int charIndex) {
  int i = 0, idx = 0, lTok;
  while (i < l(tok) && idx+(lTok = l(tok.get(i))) <= charIndex) {
    idx += lTok;
    i++;
  }
  ret CharInToken(tok, i, charIndex-idx);
}

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: 142 / 212
Version history: 1 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)
#1034157 - test_charIndexToCharInToken