1 | static int charIndexToUserLandLineNr(S text, int charIndex) {
|
2 | int i = 0, row = 1; |
3 | charIndex = min(charIndex, l(text)); |
4 | while (i < charIndex) {
|
5 | i = smartIndexOf(text, '\n', i)+1; |
6 | if (charIndex < i) break; |
7 | ++row; |
8 | if (charIndex == i) break; |
9 | } |
10 | ret row; |
11 | } |
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: | 565 / 619 |
| Version history: | 2 change(s) |
| Referenced in: | [show references] |