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

5
LINES

< > BotCompany Repo | #1021832 // appendWithNewLine - inserts new line between a and b if they are both not empty

JavaX fragment (include)

1  
sS appendWithNewLine(S a, S b) {
2  
  if (empty(b)) ret a;
3  
  if (empty(a)) ret b;
4  
  ret addSuffix(a, "\n") + b;
5  
}

Author comment

Began life as a copy of #1014093

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: #1021832
Snippet name: appendWithNewLine - inserts new line between a and b if they are both not empty
Eternal ID of this version: #1021832/3
Text MD5: b0ec614a352b3694d759898bc59eb0d1
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-03-01 11:45:59
Source code size: 114 bytes / 5 lines
Pitched / IR pitched: No / No
Views / Downloads: 370 / 398
Version history: 2 change(s)
Referenced in: [show references]