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

15
LINES

< > BotCompany Repo | #1013607 // dropPunctuationAtEnd_hard - actually drop all non-letters

JavaX fragment (include)

static L<S> dropPunctuationAtEnd_hard(L<S> tok) {
  tok = new ArrayList<S>(tok);
  for (int i = tok.size()-2; i > 0; i -= 2) {
    S t = tok.get(i);
    if (t.length() == 1 && !Character.isLetterOrDigit(t.charAt(0))) {
      tok.remove(i);
      tok.remove(i);
    } else break;
  }
  return tok;
}

static S dropPunctuationAtEnd_hard(S s) {
  ret join(dropPunctuationAtEnd_hard(nlTok(s)));
}

Author comment

Began life as a copy of #1008344

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: #1013607
Snippet name: dropPunctuationAtEnd_hard - actually drop all non-letters
Eternal ID of this version: #1013607/3
Text MD5: 377ced72c37115cbbded410b5d4700f4
Author: stefan
Category:
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-01-11 14:26:49
Source code size: 406 bytes / 15 lines
Pitched / IR pitched: No / No
Views / Downloads: 216 / 256
Version history: 2 change(s)
Referenced in: [show references]