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

9
LINES

< > BotCompany Repo | #1021387 // splitAtTokenIndices - assumes one split token

JavaX fragment (include)

static L<S> splitAtTokenIndices(LS tok, L<Int> indices) {
  new L<S> l;
  for (int iI = -1; iI < l(indices); iI++) {
    int i = or(get(indices, iI), 0)+1;
    int j = or(get(indices, iI+1), l(tok));
    l.add(trimJoin(tok.subList(i, j)));
  }
  ret l;
}

Author comment

Began life as a copy of #1017544

download  show line numbers  debug dex  old transpilations   

Travelled to 7 computer(s): bhatertpkbcr, cfunsshuasjs, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1021387
Snippet name: splitAtTokenIndices - assumes one split token
Eternal ID of this version: #1021387/6
Text MD5: 2d5e4751aca16f52fd352ad16c613a2d
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-02-10 17:56:13
Source code size: 262 bytes / 9 lines
Pitched / IR pitched: No / No
Views / Downloads: 369 / 378
Version history: 5 change(s)
Referenced in: [show references]