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

12
LINES

< > BotCompany Repo | #1028131 // joinSubstringObjects

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

Transpiled version (2534L) is out of date.

1  
static Substring joinSubstringObjects(Iterable<Substring> l) {
2  
  Iterator<Substring> it = iterator(l);
3  
  if (!it.hasNext()) null;
4  
  Substring s = it.next();
5  
  while (it.hasNext()) {
6  
    Substring b = it.next();
7  
    if (s.s != b.s) fail("Substrings have different base string");
8  
    if (s.endIndex() != b.startIndex()) fail("Substrings don't fit: " + s.range() + " / " + b.range());
9  
    s = Substring(s.s, s.startIndex(), s.length()+b.length());
10  
  }
11  
  ret s;
12  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 7 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv

No comments. add comment

Snippet ID: #1028131
Snippet name: joinSubstringObjects
Eternal ID of this version: #1028131/2
Text MD5: 67134b3a801bc3ea5324ba4a727d48e4
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-07-25 00:57:21
Source code size: 470 bytes / 12 lines
Pitched / IR pitched: No / No
Views / Downloads: 181 / 263
Version history: 1 change(s)
Referenced in: [show references]