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)

static S textOut_or_curly(L<S> l) {
  ret textOut_or_curly(l, "nothing");
}

static S textOut_or_curly(L<S> l, S emptyText) {
  if (empty(l)) ret emptyText;
  L<S> separators = rep(", ", l(l)-2);
  separators.add(" or ");
  ret join_flex(separators, map curlyOpt(l));
}

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