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)

sS combineToNLPatternIncludingPunctuation(S a, S b) {
  if (a == null || b == null) null;
  L<S> tok1 = codeTokens(javaTok(a));
  L<S> tok2 = codeTokens(javaTok(b));
  if (l(tok1) != l(tok2)) null;
  new L<S> out;
  for i over tok1: {
    S t = tok1.get(i);
    out.add(eqic(t, tok2.get(i)) ? t : "*");
  }
  ret joinWithSpace(out);
}

sS combineToNLPatternIncludingPunctuation(Iterable<S> l) {
  ret foldl_noSeed(func(S a, S b) -> S { combineToNLPatternIncludingPunctuation(a, b) }, l);
}

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: 253 / 252
Version history: 1 change(s)
Referenced in: [show references]