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

13
LINES

< > BotCompany Repo | #1021560 // joinLinesWithBarOrPunctuation

JavaX fragment (include)

1  
sS joinLinesWithBarOrPunctuation(S text) {
2  
  LS lines = tlft(text);
3  
  new StringBuilder buf;
4  
  S sep = "";
5  
  for (S s : lines) {
6  
    buf.append(sep).append(s);
7  
    if (endsWithPunctuation(s))
8  
      sep = " ";
9  
    else
10  
      sep = " | ";
11  
  }
12  
  ret str(buf);
13  
}

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: 179 / 220
Version history: 2 change(s)
Referenced in: [show references]