static int charIndexToUserLandLineNr(S text, int charIndex) { int i = 0, row = 1; charIndex = min(charIndex, l(text)); while (i < charIndex) { i = smartIndexOf(text, '\n', i)+1; if (charIndex < i) break; ++row; if (charIndex == i) break; } ret row; }
Began life as a copy of #1012342
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: | #1014785 |
| Snippet name: | charIndexToUserLandLineNr (line counted from 1) |
| Eternal ID of this version: | #1014785/3 |
| Text MD5: | 1be7f2cea76e446be61b87a18a0a4f3b |
| Author: | stefan |
| Category: | javax |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2018-05-07 14:42:12 |
| Source code size: | 286 bytes / 11 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 566 / 621 |
| Version history: | 2 change(s) |
| Referenced in: | #1006654 - Standard functions list 2 (LIVE, continuation of #761) #1014968 - tokenIndexToUserLandLineNr (line counted from 1) #1016504 - charToLineIndex (line counted from 0) |