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

6
LINES

< > BotCompany Repo | #1018064 // shortenToMaxLinesAndChars - actually uses one more line for the ...

JavaX fragment (include)

sS shortenToMaxLinesAndChars(S s, int maxLines, int maxChars) {
  s = shorten(s, maxChars);
  LS lines = lines(s);  
  if (l(lines) <= maxLines) ret s;
  ret lines(takeFirst(maxLines, lines)) + "...";
}

download  show line numbers  debug dex  old transpilations   

Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1018064
Snippet name: shortenToMaxLinesAndChars - actually uses one more line for the ...
Eternal ID of this version: #1018064/2
Text MD5: 95d7d85b03f9498c4751dda75578c2aa
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-08-29 12:30:39
Source code size: 207 bytes / 6 lines
Pitched / IR pitched: No / No
Views / Downloads: 339 / 379
Version history: 1 change(s)
Referenced in: [show references]