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).

1  
static LS ai_twoLinesToFlexStarPattern_1(S a, S b, O... _) {
2  
  optPar bool verbose;
3  
  LS tokA = javaTokC(a), tokB = javaTokC(b);
4  
  new LS out;
5  
  for i over tokA: {
6  
    S word = tokA.get(i);
7  
    for (int j : indicesOfIC(tokB, word)) {
8  
      if (verbose) print(word + ": " + i + " / " + j);
9  
      S pat1 = (i == 0 ? "" : "* ") + word + (i == l(tokA)-1 ? "" : " *");
10  
      S pat2 = (j == 0 ? "" : "* ") + word + (j == l(tokB)-1 ? "" : " *");
11  
      if (verbose) print(+pat1);
12  
      if (verbose) print(+pat2);
13  
      if (eq(pat1, pat2))
14  
        out.add(pat1);
15  
    }
16  
  }
17  
  ret out;
18  
}

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: 191 / 270
Referenced in: [show references]