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

10
LINES

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

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

Libraryless. Click here for Pure Java version (2183L/14K).

static S textOut_or(Cl l) {
  ret textOut_or(l, "nothing");
}

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

Author comment

Began life as a copy of #1009473

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1017496
Snippet name: textOut_or - join strings as "a, b or c"
Eternal ID of this version: #1017496/4
Text MD5: 8c05222413d0febfb4ff74c2e4a9bcc7
Transpilation MD5: f87300064ea5439249c56bd17c9fadb2
Author: stefan
Category: javax / a.i.
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-01-20 15:09:54
Source code size: 242 bytes / 10 lines
Pitched / IR pitched: No / No
Views / Downloads: 462 / 556
Version history: 3 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)
#1017500 - textOut_or_orAll - join strings as "a, b or c or all of these"
#1017503 - textOut_or_curly - join strings as "a, b or c"