Libraryless. Click here for Pure Java version (2718L/16K).
1 | static S joinStrings(S sep, O... strings) { |
2 | ret joinStrings(sep, Arrays.asList(strings)); |
3 | } |
4 | |
5 | static S joinStrings(S sep, Iterable strings) { |
6 | new StringBuilder buf; |
7 | for (O o : unnull(strings)) { |
8 | S s = strOrNull(o); |
9 | if (nempty(s)) { |
10 | if (nempty(buf)) buf.append(sep); |
11 | buf.append(s); |
12 | } |
13 | } |
14 | ret str(buf); |
15 | } |
download show line numbers debug dex old transpilations
Travelled to 16 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ekrmjmnbrukm, gjtlkbvenryc, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mowyntqkapby, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1006693 |
Snippet name: | joinStrings - join non-empty strings with separator |
Eternal ID of this version: | #1006693/3 |
Text MD5: | 6d8a3fa6509928170495ce186c8f1223 |
Transpilation MD5: | e089f4c08ae45f59a109c57a354f63ba |
Author: | stefan |
Category: | javax / gui |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2021-01-04 04:15:15 |
Source code size: | 348 bytes / 15 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 512 / 968 |
Version history: | 2 change(s) |
Referenced in: | [show references] |