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

13
LINES

< > BotCompany Repo | #1025441 // splitTokensWithSpaces

JavaX fragment (include)

static LS mapLike splitTokensWithSpaces(O splitter, LS tok) {
  new LS out;
  LS l;
  for i over tok:
    if (odd(i) && l(l = (LS) callF(splitter, tok.get(i))) > 1) {
      for j over l: {
        if (j > 0) out.add(" ");
        out.add(l.get(j));
      }
    } else
      out.add(tok.get(i));
  ret out;
}

Author comment

Began life as a copy of #1022427

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: #1025441
Snippet name: splitTokensWithSpaces
Eternal ID of this version: #1025441/1
Text MD5: a89947d74b8a48178fa9d508510b5f54
Author: stefan
Category: javax / tokenizing
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-09-29 00:28:22
Source code size: 319 bytes / 13 lines
Pitched / IR pitched: No / No
Views / Downloads: 201 / 231
Referenced in: [show references]