// does not return unclosed strings
static L<S> findSubstringsEnclosedBy(S s, char a, char b) {
int i = 0;
new L<S> l;
while ((i = indexOf(s, a, i)) >= 0) {
int j = indexOf(s, b, i+1);
if (j < 0) break;
l.add(substring(s, i, j+1));
i = j+1;
}
ret l;
}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: | #1008502 |
| Snippet name: | findSubstringsEnclosedBy |
| Eternal ID of this version: | #1008502/1 |
| Text MD5: | 6f1d1d1cfdf72e80a83a3065d9ce6301 |
| Author: | stefan |
| Category: | javax |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2017-05-20 12:47:01 |
| Source code size: | 288 bytes / 12 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 992 / 998 |
| Referenced in: | #1006654 - Standard functions list 2 (LIVE, continuation of #761) #1008511 - findSubstringsEnclosedBy_inner - return strings without begin/end markers |