// TODO: returns empty first, but not empty last static L<S> splitAt(S s, S splitter) { if (empty(splitter)) null; // avoid endless loop new L<S> parts; int i = 0; if (s != null) while (i < l(s)) { int j = indexOf(s, splitter, i); if (j < 0) j = l(s); parts.add(substring(s, i, j)); i = j+l(splitter); } ret parts; }
download show line numbers debug dex old transpilations
Travelled to 16 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ddnzoavkxhuk, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt, whxojlpjdney, xrpafgyirdlv
No comments. add comment
| Snippet ID: | #1004456 |
| Snippet name: | splitAt - split string at literal substring |
| Eternal ID of this version: | #1004456/2 |
| Text MD5: | e9fab4a3e991a33223611bfd39fa2682 |
| Author: | stefan |
| Category: | javax |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2020-06-14 20:32:30 |
| Source code size: | 371 bytes / 14 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 988 / 1032 |
| Version history: | 1 change(s) |
| Referenced in: | [show references] |