Libraryless. Click here for Pure Java version (4612L/26K).
ifclass ListAndIndex static int tokenToCharIndex(ListAndIndex<S> ptr) { ret ptr == null ? -1 : tokenToCharIndex(ptr.list(), ptr.idx()); } endif static int tokenToCharIndex(LS tok, int tokenIndex) { if (tokenIndex < 0) ret -1; int idx = 0; tokenIndex = min(tokenIndex, l(tok)); for i to tokenIndex: idx += l(tok.get(i)); ret idx; }
Began life as a copy of #1008633
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: | #1008636 |
| Snippet name: | tokenToCharIndex |
| Eternal ID of this version: | #1008636/5 |
| Text MD5: | 75eed022ff490397042e48f651197859 |
| Transpilation MD5: | e60cff8d4a031d5513033f296e0d042e |
| Author: | stefan |
| Category: | javax / parsing |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2022-01-15 20:20:57 |
| Source code size: | 355 bytes / 13 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 817 / 961 |
| Version history: | 4 change(s) |
| Referenced in: | #1006654 - Standard functions list 2 (LIVE, continuation of #761) #1012342 - charIndexOfRow (both counting from 0) #1012738 - tokenIndexToCharIndex - synonym of tokenToCharIndex #1033994 - tokenToLineAndColumn |