1 | static L<S> dropPunctuationAtEnd_keep = litlist("*", "<", ">", "]", ")", "}"); |
2 | |
3 | static L<S> dropPunctuationAtEnd(L<S> tok) { |
4 | tok = new ArrayList<S>(tok); |
5 | for (int i = tok.size()-2; i > 0; i -= 2) { |
6 | S t = tok.get(i); |
7 | if (t.length() == 1 && !Character.isLetter(t.charAt(0)) && !Character.isDigit(t.charAt(0)) && !dropPunctuationAtEnd_keep.contains(t)) { |
8 | tok.remove(i); |
9 | tok.remove(i); |
10 | } else break; |
11 | } |
12 | return tok; |
13 | } |
14 | |
15 | static S dropPunctuationAtEnd(S s) { |
16 | ret join(dropPunctuationAtEnd(nlTok(s))); |
17 | } |
Began life as a copy of #1000814
download show line numbers debug dex old transpilations
Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt, whxojlpjdney
No comments. add comment
Snippet ID: | #1008344 |
Snippet name: | dropPunctuationAtEnd |
Eternal ID of this version: | #1008344/5 |
Text MD5: | 682bdebe58a7526e2a637439d84c2624 |
Author: | stefan |
Category: | |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2018-01-06 10:25:51 |
Source code size: | 543 bytes / 17 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 525 / 879 |
Version history: | 4 change(s) |
Referenced in: | [show references] |