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

12
LINES

< > BotCompany Repo | #1024110 // ellipsisToDotStarRegexp

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

Libraryless. Click here for Pure Java version (3847L/22K).

1  
sS ellipsisToDotStarRegexp(S s) {
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(".*");
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: #1024110
Snippet name: ellipsisToDotStarRegexp
Eternal ID of this version: #1024110/1
Text MD5: 9568c3479e90d56377586b8e344ad71f
Transpilation MD5: 92d5470f1d8c5c9c7a23111c8ed801c7
Author: stefan
Category: javax / stefan's os / a.i. / web
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-07-21 01:02:26
Source code size: 273 bytes / 12 lines
Pitched / IR pitched: No / No
Views / Downloads: 268 / 355
Referenced in: [show references]