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

11
LINES

< > BotCompany Repo | #1002271 // splitByJavaToken - unclear semantics with double separators, separator at beginning/end

JavaX fragment (include)

static L<S> splitByJavaToken(S s, S splitToken) {
  L<S> tok = javaTok(s);
  new L<S> l;
  int i = 1;
  while (i < l(tok)) {
    int j = smartIndexOf(tok, splitToken, i);
    l.add(join(subList(tok, i, j-1)));
    i = j+2;
  }
  ret l;
}

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: #1002271
Snippet name: splitByJavaToken - unclear semantics with double separators, separator at beginning/end
Eternal ID of this version: #1002271/5
Text MD5: 56593b2339d0ec2499720f89220cab3f
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-06-21 19:16:26
Source code size: 247 bytes / 11 lines
Pitched / IR pitched: No / No
Views / Downloads: 630 / 1069
Version history: 4 change(s)
Referenced in: #1002284 - splitAtJavaToken - synonym of splitByJavaToken
#1002427 - Accellerating 629 (SPIKE)
#1005258 - splitAtArrow - javaTok and split at "=>"
#1006654 - Standard functions list 2 (LIVE, continuation of #761)
#1012192 - splitAtJavaTokens - allows each of the tokens to be a separator
#1013105 - tok_splitAtSpacedDashes_old - split at " - " (allowing newlines instead of spaces too)
#1013158 - splitAtJavaTokenIC
#3000382 - Answer for ferdie (>> t = 1, f = 0)
#3000383 - Answer for funkoverflow (>> t=1, f=0 okay)