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

15
LINES

< > BotCompany Repo | #1011447 // dropCertainPunctuationAtEnd

JavaX fragment (include)

static L<S> dropCertainPunctuationAtEnd(L<S> tok, S charsToDrop) {
  tok = cloneList(tok);
  for (int i = tok.size()-2; i > 0; i -= 2) {
    S t = tok.get(i);
    if (t.length() == 1 && charsToDrop.contains(t)) {
      tok.remove(i+1);
      tok.remove(i);
    } else break;
  }
  return tok;
}

static S dropCertainPunctuationAtEnd(S s, S chars) {
  ret join(dropCertainPunctuationAtEnd(nlTok(s), chars));
}

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: #1011447
Snippet name: dropCertainPunctuationAtEnd
Eternal ID of this version: #1011447/1
Text MD5: 53cf9c7f4c54461b27c6c296eea86a43
Author: stefan
Category:
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-10-29 16:48:16
Source code size: 422 bytes / 15 lines
Pitched / IR pitched: No / No
Views / Downloads: 469 / 523
Referenced in: [show references]