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

9
LINES

< > BotCompany Repo | #1013387 // ai_splitAroundPhrase - split at a phrase such as. "iff it", drops the phrase itself

JavaX fragment (include)

static L<S> ai_splitAroundPhrase(S s, S phrase) {
  ret ai_splitAroundPhrase(javaTokWithBrackets(s), phrase);
}
  
static L<S> ai_splitAroundPhrase(LS tok, S phrase) {
  S[] _phrase = toStringArray(javaTokC(phrase));
  int i = findCodeTokensIC(tok, _phrase);
  ret i < 0 ? ll(join(tok)) : ll(trimJoinSubList(tok, 0, i), trimJoinSubList(tok, i+l(_phrase)*2));
}

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: #1013387
Snippet name: ai_splitAroundPhrase - split at a phrase such as. "iff it", drops the phrase itself
Eternal ID of this version: #1013387/7
Text MD5: 042421999f21dcf346e31881bcc0dc31
Author: stefan
Category: javax / a.i.
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-03-04 17:35:00
Source code size: 368 bytes / 9 lines
Pitched / IR pitched: No / No
Views / Downloads: 415 / 482
Version history: 6 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)
#1015347 - splitAroundColon_toPair
#1021988 - ai_splitAroundPhrase_orNull - split at a phrase such as. "iff it", drops the phrase itself