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

16
LINES

< > BotCompany Repo | #1021097 // combineToNLPatternIncludingPunctuation (ignoring case)

JavaX fragment (include)

1  
sS combineToNLPatternIncludingPunctuation(S a, S b) {
2  
  if (a == null || b == null) null;
3  
  L<S> tok1 = codeTokens(javaTok(a));
4  
  L<S> tok2 = codeTokens(javaTok(b));
5  
  if (l(tok1) != l(tok2)) null;
6  
  new L<S> out;
7  
  for i over tok1: {
8  
    S t = tok1.get(i);
9  
    out.add(eqic(t, tok2.get(i)) ? t : "*");
10  
  }
11  
  ret joinWithSpace(out);
12  
}
13  
14  
sS combineToNLPatternIncludingPunctuation(Iterable<S> l) {
15  
  ret foldl_noSeed(func(S a, S b) -> S { combineToNLPatternIncludingPunctuation(a, b) }, l);
16  
}

Author comment

Began life as a copy of #1017024

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: #1021097
Snippet name: combineToNLPatternIncludingPunctuation (ignoring case)
Eternal ID of this version: #1021097/2
Text MD5: 5d0966bea7fcc5b85dade94575bddf5b
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-01-22 16:02:03
Source code size: 504 bytes / 16 lines
Pitched / IR pitched: No / No
Views / Downloads: 338 / 331
Version history: 1 change(s)
Referenced in: [show references]