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

13
LINES

< > BotCompany Repo | #1018006 // jextractWithRests - jfind and return text before, found text and text after

JavaX fragment (include)

1  
// returns from C to C
2  
static T3<S> jextractWithRests(S pat, S s) {
3  
  ret jextractWithRests(pat, javaTok(s));
4  
}
5  
6  
static T3<S> jextractWithRests(S pat, L<S> tok) {
7  
  L<S> tokpat = javaTok(pat);
8  
  jfind_preprocess(tokpat);
9  
  int i = jfind(tok, tokpat);
10  
  if (i < 0) null;
11  
  int j = i + l(tokpat) - 2;
12  
  ret t3(joinSubList(tok, 0, i), joinSubList(tok, i, j), joinSubList(tok, j));
13  
}

Author comment

Began life as a copy of #1004321

download  show line numbers  debug dex  old transpilations   

Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1018006
Snippet name: jextractWithRests - jfind and return text before, found text and text after
Eternal ID of this version: #1018006/2
Text MD5: 8328137f2c8202765d31f408430c9874
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-08-25 13:30:48
Source code size: 393 bytes / 13 lines
Pitched / IR pitched: No / No
Views / Downloads: 272 / 283
Version history: 1 change(s)
Referenced in: [show references]