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

12
LINES

< > BotCompany Repo | #1006693 - joinStrings - join non-empty strings with separator

JavaX fragment (include)

static S joinStrings(S sep, S... strings) {
  ret joinStrings(sep, Arrays.asList(strings));
}

static S joinStrings(S sep, Collection<S> strings) {
  new StringBuilder buf;
  for (S s : unnull(strings)) if (nempty(s)) {
    if (nempty(buf)) buf.append(sep);
    buf.append(s);
  }
  ret str(buf);
}

download  show line numbers  debug dex   

Travelled to 9 computer(s): aoiabmzegqzx, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, tslmcundralx, tvejysmllsmz

No comments. add comment

Snippet ID: #1006693
Snippet name: joinStrings - join non-empty strings with separator
Eternal ID of this version: #1006693/2
Text MD5: 876f194fcf83fe67e6b71147b66dc0cb
Author: stefan
Category: javax / gui
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-10-12 18:49:48
Source code size: 309 bytes / 12 lines
Pitched / IR pitched: No / No
Views / Downloads: 241 / 232
Version history: 1 change(s)
Referenced in: [show references]

Formerly at http://tinybrain.de/1006693 & http://1006693.tinybrain.de