// assumes indices are sorted static L<S> splitStringAtIndices(S s, L<Int> indices) { Iterator<Int> it = indices.iterator(); new L<S> parts; int i = 0; while true { if (!it.hasNext()) { parts.add(substring(s, i)); break; } int j = it.next(); parts.add(substring(s, i, j)); i = j; } ret parts; }
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: | #1012734 |
| Snippet name: | splitStringAtIndices |
| Eternal ID of this version: | #1012734/2 |
| Text MD5: | 0019f91c1068c8dd38484f40a9598a3f |
| Author: | stefan |
| Category: | javax |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2017-12-11 15:23:28 |
| Source code size: | 353 bytes / 16 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 680 / 687 |
| Version history: | 1 change(s) |
| Referenced in: | [show references] |