1 | static S textOut_and(Collection<S> l) {
|
2 | ret textOut_and(l, "nothing"); |
3 | } |
4 | |
5 | static S textOut_and(Collection<S> l, S emptyText) {
|
6 | if (empty(l)) ret emptyText; |
7 | L<S> separators = rep(", ", l(l)-2);
|
8 | separators.add(" and ");
|
9 | ret join_flex(separators, l); |
10 | } |
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: | #1009473 |
| Snippet name: | textOut_and - join strings as "a, b and c" |
| Eternal ID of this version: | #1009473/6 |
| Text MD5: | cfe4b65660198197328745a2e308df5f |
| Author: | stefan |
| Category: | javax / a.i. |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2018-08-26 20:59:54 |
| Source code size: | 268 bytes / 10 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 720 / 785 |
| Version history: | 5 change(s) |
| Referenced in: | [show references] |