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

13
LINES

< > BotCompany Repo | #1025441 // splitTokensWithSpaces

JavaX fragment (include)

1  
static LS mapLike splitTokensWithSpaces(O splitter, LS tok) {
2  
  new LS out;
3  
  LS l;
4  
  for i over tok:
5  
    if (odd(i) && l(l = (LS) callF(splitter, tok.get(i))) > 1) {
6  
      for j over l: {
7  
        if (j > 0) out.add(" ");
8  
        out.add(l.get(j));
9  
      }
10  
    } else
11  
      out.add(tok.get(i));
12  
  ret out;
13  
}

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: 204 / 235
Referenced in: [show references]