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

11
LINES

< > BotCompany Repo | #1012968 // ai_ifThenToMultiLine - idempotent

JavaX fragment (include)

static S ai_ifThenToMultiLine(S s) {
  s = trim(s);
  if (containsNewLine(s)) ret s;
  L<S> tok = tok_groupRoundBrackets(javaTok(s));
  int i = 2;
  while ((i = indexOfOneOfIC(tok, i, "then", "and")) >= 0) {
    tokPrepend(tok, i, "\n");
    i += 2;
  }
  ret join(tok);
}

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: #1012968
Snippet name: ai_ifThenToMultiLine - idempotent
Eternal ID of this version: #1012968/5
Text MD5: 1bd3d8a55b4fdde7929d15b6f89fade2
Author: stefan
Category: javax / parsing
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-12-18 23:33:41
Source code size: 282 bytes / 11 lines
Pitched / IR pitched: No / No
Views / Downloads: 455 / 484
Version history: 4 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)