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

12
LINES

< > BotCompany Repo | #1024119 // ellipsisToRegexp_generic

JavaX fragment (include)

1  
sS ellipsisToRegexp_generic(S s, S replacementForEllipsis) {
2  
  int i = 0;
3  
  new StringBuffer buf;
4  
  while (i < l(s)) {
5  
    int j = smartIndexOf(s, "...", i);
6  
    buf.append(regexpQuote(substring(s, i, j)));
7  
    if (j >= l(s)) break;
8  
    buf.append(replacementForEllipsis);
9  
    i = j+3;
10  
  }
11  
  ret str(buf);
12  
}

Author comment

Began life as a copy of #1024108

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1024119
Snippet name: ellipsisToRegexp_generic
Eternal ID of this version: #1024119/1
Text MD5: a3af1ee11a0b6f60bdff6cde50059467
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-07-21 15:26:55
Source code size: 318 bytes / 12 lines
Pitched / IR pitched: No / No
Views / Downloads: 224 / 264
Referenced in: [show references]