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

13
LINES

< > BotCompany Repo | #1021560 // joinLinesWithBarOrPunctuation

JavaX fragment (include)

sS joinLinesWithBarOrPunctuation(S text) {
  LS lines = tlft(text);
  new StringBuilder buf;
  S sep = "";
  for (S s : lines) {
    buf.append(sep).append(s);
    if (endsWithPunctuation(s))
      sep = " ";
    else
      sep = " | ";
  }
  ret str(buf);
}

download  show line numbers  debug dex  old transpilations   

Travelled to 7 computer(s): bhatertpkbcr, cfunsshuasjs, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1021560
Snippet name: joinLinesWithBarOrPunctuation
Eternal ID of this version: #1021560/3
Text MD5: 2266b6aa549f610b2ad9321af961b817
Author: stefan
Category: javax / a.i.
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-02-18 21:18:40
Source code size: 270 bytes / 13 lines
Pitched / IR pitched: No / No
Views / Downloads: 174 / 215
Version history: 2 change(s)
Referenced in: [show references]