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).

sS shortenJoin(int max, Iterable<S> l) {
  new StringBuilder buf;
  fOr (S s : l) {
    buf.append(s);
    if (l(buf) > max)
      break;
  }
  ret shorten(max, str(buf));
}

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: 141 / 204
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)