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)

// returns from C to C
static T3<S> jextractWithRests(S pat, S s) {
  ret jextractWithRests(pat, javaTok(s));
}

static T3<S> jextractWithRests(S pat, L<S> tok) {
  L<S> tokpat = javaTok(pat);
  jfind_preprocess(tokpat);
  int i = jfind(tok, tokpat);
  if (i < 0) null;
  int j = i + l(tokpat) - 2;
  ret t3(joinSubList(tok, 0, i), joinSubList(tok, i, j), joinSubList(tok, j));
}

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: 341 / 347
Version history: 1 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)