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

13
LINES

< > BotCompany Repo | #1022961 // ai_groupLeftAndRightOfPhrase

JavaX fragment (include)

sS ai_groupLeftAndRightOfPhrase(S phrase, S s) {
  ret ai_groupLeftAndRightOfPhrase(phrase, javaTokWithBrackets(s));
}
  
sS ai_groupLeftAndRightOfPhrase(S phrase, LS tok) {
  S[] _phrase = toStringArray(javaTokC(phrase));
  int i = findCodeTokensIC(tok, _phrase);
  if (i < 0) ret join(tok);
  ret first(tok) + curly(joinSubList(tok, 1, i-1))
    + joinSubList(tok, i-1, i+l(_phrase)*2)
    + curly(joinSubList(tok, i+l(_phrase)*2, l(tok)-1))
    + last(tok);
}

Author comment

Began life as a copy of #1021988

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: #1022961
Snippet name: ai_groupLeftAndRightOfPhrase
Eternal ID of this version: #1022961/4
Text MD5: 78a8b6aa0e35da6d31a5e6f62abcf59f
Author: stefan
Category: javax / a.i.
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-04-15 20:32:16
Source code size: 474 bytes / 13 lines
Pitched / IR pitched: No / No
Views / Downloads: 282 / 309
Version history: 3 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)