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

14
LINES

< > BotCompany Repo | #1025633 // tok_splitAtCommaOrAnd - split at ",", "and" or ", and"

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (2358L/15K).

static L<S> tok_splitAtCommaOrAnd(S s) {
  ret tok_splitAtCommaOrAnd(javaTok(s));
}
  
static L<S> tok_splitAtCommaOrAnd(L<S> tok) {
  new L<S> out;
  for i over tok: {
    int j = smartIndexOfAnyIC(tok, i, ",", "and");
    out.add(joinSubList(tok, i+1, j-1));
    while (j < l(tok) && eqicOneOf(tok.get(j+2), ",", "and")) j += 2;
    i = j;
  }
  ret out;
}

Author comment

Began life as a copy of #1016884

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1025633
Snippet name: tok_splitAtCommaOrAnd - split at ",", "and" or ", and"
Eternal ID of this version: #1025633/4
Text MD5: 5c267859ba97a2e4987520aca914ef9b
Transpilation MD5: 379b6007525ee6084bc486b568ced62e
Author: stefan
Category: javax / parsing
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-10-10 01:28:53
Source code size: 371 bytes / 14 lines
Pitched / IR pitched: No / No
Views / Downloads: 124 / 192
Version history: 3 change(s)
Referenced in: [show references]