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

14
LINES

< > BotCompany Repo | #1001693 - removeToken - merges whitespace

JavaX fragment (include)

static void removeToken(L<S> tok, int i) {
  if (i+2 == l(tok)) {
    truncateList(tok, i);
    tok.set(i-1, "");
    ret;
  }
  
  // join white space
  if (!(tok.get(i-1).equals(" ") && tok.get(i+1).equals(" ")))
    tok.set(i-1, tok.get(i) + tok.get(i+1));
    
  // remove token
  removeSubList(tok, i, i+2);
}

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: #1001693
Snippet name: removeToken - merges whitespace
Eternal ID of this version: #1001693/5
Text MD5: 94a2ff590fe2d2ee6937921faa175704
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-05-18 13:34:30
Source code size: 327 bytes / 14 lines
Pitched / IR pitched: No / No
Views / Downloads: 534 / 721
Version history: 4 change(s)
Referenced in: [show references]