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

9
LINES

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

JavaX fragment (include)

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

Author comment

Began life as a copy of #1013387

download  show line numbers  debug dex  old transpilations   

Travelled to 7 computer(s): bhatertpkbcr, cfunsshuasjs, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1021988
Snippet name: ai_splitAroundPhrase_orNull - split at a phrase such as. "iff it", drops the phrase itself
Eternal ID of this version: #1021988/2
Text MD5: 635aafc7fce25eb92e71eff3e1405fc9
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:32
Source code size: 380 bytes / 9 lines
Pitched / IR pitched: No / No
Views / Downloads: 192 / 229
Version history: 1 change(s)
Referenced in: [show references]