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

12
LINES

< > BotCompany Repo | #1024119 // ellipsisToRegexp_generic

JavaX fragment (include)

sS ellipsisToRegexp_generic(S s, S replacementForEllipsis) {
  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(replacementForEllipsis);
    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: #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: 223 / 263
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)