static L<S> dropPunctuationExcept(L<S> tok, L<S> keep) { tok = new ArrayList<S>(tok); for (int i = 1; i < tok.size(); i += 2) { S t = tok.get(i); if (t.length() == 1 && !Character.isLetter(t.charAt(0)) && !Character.isDigit(t.charAt(0)) && !keep.contains(t)) { tok.set(i-1, tok.get(i-1) + tok.get(i+1)); tok.remove(i); tok.remove(i); i -= 2; } } return tok; } static S dropPunctuationExcept(S s, L<S> keep) { ret join(dropPunctuationExcept(nlTok(s), keep)); }
Began life as a copy of #1000814
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: | #1002702 |
Snippet name: | dropPunctuationExcept |
Eternal ID of this version: | #1002702/1 |
Text MD5: | cb769214937eb19b176fc227cce6117e |
Author: | stefan |
Category: | |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2016-02-15 21:51:52 |
Source code size: | 522 bytes / 17 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 631 / 601 |
Referenced in: | #1006654 - Standard functions list 2 (LIVE, continuation of #761) #3000382 - Answer for ferdie (>> t = 1, f = 0) #3000383 - Answer for funkoverflow (>> t=1, f=0 okay) |