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

10
LINES

< > BotCompany Repo | #1017503 // textOut_or_curly - join strings as "a, b or c"

JavaX fragment (include)

1  
static S textOut_or_curly(L<S> l) {
2  
  ret textOut_or_curly(l, "nothing");
3  
}
4  
5  
static S textOut_or_curly(L<S> l, S emptyText) {
6  
  if (empty(l)) ret emptyText;
7  
  L<S> separators = rep(", ", l(l)-2);
8  
  separators.add(" or ");
9  
  ret join_flex(separators, map curlyOpt(l));
10  
}

Author comment

Began life as a copy of #1017496

download  show line numbers  debug dex  old transpilations   

Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1017503
Snippet name: textOut_or_curly - join strings as "a, b or c"
Eternal ID of this version: #1017503/1
Text MD5: 04d3740bbe29c3f209fa8ebd95b5124c
Author: stefan
Category: javax / a.i.
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-07-24 01:40:22
Source code size: 278 bytes / 10 lines
Pitched / IR pitched: No / No
Views / Downloads: 341 / 378
Referenced in: [show references]