Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

12
LINES

< > BotCompany Repo | #1008502 // findSubstringsEnclosedBy

JavaX fragment (include)

1  
// does not return unclosed strings
2  
static L<S> findSubstringsEnclosedBy(S s, char a, char b) {
3  
  int i = 0;
4  
  new L<S> l;
5  
  while ((i = indexOf(s, a, i)) >= 0) {
6  
    int j = indexOf(s, b, i+1);
7  
    if (j < 0) break;
8  
    l.add(substring(s, i, j+1));
9  
    i = j+1;
10  
  }
11  
  ret l;
12  
}

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: 398 / 409
Referenced in: [show references]