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

sS ellipsisToDotStarRegexp(S s) {
  int i = 0;
  new StringBuffer buf;
  while (i < l(s)) {
    int j = smartIndexOf(s, "...", i);
    buf.append(regexpQuote(substring(s, i, j)));
    if (j >= l(s)) break;
    buf.append(".*");
    i = j+3;
  }
  ret str(buf);
}

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: 266 / 352
Referenced in: [show references]