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

18
LINES

< > BotCompany Repo | #1030021 // ai_twoLinesToFlexStarPattern_1

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (3184L/20K).

static LS ai_twoLinesToFlexStarPattern_1(S a, S b, O... _) {
  optPar bool verbose;
  LS tokA = javaTokC(a), tokB = javaTokC(b);
  new LS out;
  for i over tokA: {
    S word = tokA.get(i);
    for (int j : indicesOfIC(tokB, word)) {
      if (verbose) print(word + ": " + i + " / " + j);
      S pat1 = (i == 0 ? "" : "* ") + word + (i == l(tokA)-1 ? "" : " *");
      S pat2 = (j == 0 ? "" : "* ") + word + (j == l(tokB)-1 ? "" : " *");
      if (verbose) print(+pat1);
      if (verbose) print(+pat2);
      if (eq(pat1, pat2))
        out.add(pat1);
    }
  }
  ret out;
}

download  show line numbers  debug dex  old transpilations   

Travelled to 4 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, vouqrxazstgt

No comments. add comment

Snippet ID: #1030021
Snippet name: ai_twoLinesToFlexStarPattern_1
Eternal ID of this version: #1030021/1
Text MD5: a3551f0717f3c12f930bfb665d287e54
Transpilation MD5: c868c1db5b157c24875a81ddb2b6a086
Author: stefan
Category: javax / gazelle.rocks
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-10-30 10:44:09
Source code size: 593 bytes / 18 lines
Pitched / IR pitched: No / No
Views / Downloads: 189 / 268
Referenced in: [show references]