Libraryless. Click here for Pure Java version (1656L/11K).
1 | static L<S> splitAt_withEmptyLast(S s, S splitter) {
|
2 | new L<S> parts; |
3 | if (nempty(s)) {
|
4 | int i = 0; |
5 | while (i < l(s)) {
|
6 | int j = indexOf(s, splitter, i); |
7 | if (j < 0) break; |
8 | parts.add(substring(s, i, j)); |
9 | i = j+l(splitter); |
10 | } |
11 | parts.add(substring(s, i)); |
12 | } |
13 | ret parts; |
14 | } |
Began life as a copy of #1004456
download show line numbers debug dex old transpilations
Travelled to 6 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt
No comments. add comment
| Snippet ID: | #1024605 |
| Snippet name: | splitAt_withEmptyLast - split string at literal substring [dev.] |
| Eternal ID of this version: | #1024605/3 |
| Text MD5: | bde9d142cd5d66d0d32a02f94156a83d |
| Transpilation MD5: | 409c04e3075a4d966001708ddd9b8883 |
| Author: | stefan |
| Category: | javax |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2019-08-19 21:25:48 |
| Source code size: | 322 bytes / 14 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 378 / 507 |
| Version history: | 2 change(s) |
| Referenced in: | [show references] |