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

12
LINES

< > BotCompany Repo | #1008511 // findSubstringsEnclosedBy_inner - return strings without begin/end markers

JavaX fragment (include)

1  
// does not return unclosed strings
2  
static L<S> findSubstringsEnclosedBy_inner(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+1, j));
9  
    i = j+1;
10  
  }
11  
  ret l;
12  
}

Author comment

Began life as a copy of #1008502

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: #1008511
Snippet name: findSubstringsEnclosedBy_inner - return strings without begin/end markers
Eternal ID of this version: #1008511/2
Text MD5: 3b07e99cdcb23e213e31468c1a0b57de
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-05-20 13:56:34
Source code size: 294 bytes / 12 lines
Pitched / IR pitched: No / No
Views / Downloads: 563 / 561
Version history: 1 change(s)
Referenced in: [show references]