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

9
LINES

< > BotCompany Repo | #1035340 // shortenJoin - shorten + join

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (7928L/44K).

1  
sS shortenJoin(int max, Iterable<S> l) {
2  
  new StringBuilder buf;
3  
  fOr (S s : l) {
4  
    buf.append(s);
5  
    if (l(buf) > max)
6  
      break;
7  
  }
8  
  ret shorten(max, str(buf));
9  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 3 computer(s): bhatertpkbcr, mowyntqkapby, mqqgnosmbjvj

No comments. add comment

Snippet ID: #1035340
Snippet name: shortenJoin - shorten + join
Eternal ID of this version: #1035340/1
Text MD5: 5296a7f6a6fac8d6cda9dc877bde1f0b
Transpilation MD5: 609dfe1d9ebbe5db42afa96890adc840
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-05-01 18:06:46
Source code size: 181 bytes / 9 lines
Pitched / IR pitched: No / No
Views / Downloads: 140 / 202
Referenced in: [show references]