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

11
LINES

< > BotCompany Repo | #1008771 // replaceRangesWithXYZVars

JavaX fragment (include)

1  
static S replaceRangesWithXYZVars(S s, L<IntRange> ranges) {
2  
  new StringBuilder buf;
3  
  int i = 0, varIndex = 0;
4  
  for (IntRange r : ranges) {
5  
    if (i < r.start) buf.append(substring(s, i, r.start));
6  
    buf.append(xyzVar(++varIndex));
7  
    i = r.end;
8  
  }
9  
  if (i < l(s)) buf.append(substring(s, i));
10  
  ret str(buf);
11  
}

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1008771
Snippet name: replaceRangesWithXYZVars
Eternal ID of this version: #1008771/1
Text MD5: 3f38efce3bcb8d5edbf1f67f97fba05d
Author: stefan
Category: javax / a.i.
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-06-02 12:16:56
Source code size: 329 bytes / 11 lines
Pitched / IR pitched: No / No
Views / Downloads: 466 / 525
Referenced in: [show references]