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

12
LINES

< > BotCompany Repo | #1021370 // regexpReplace_direct - with direct replacement

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

Libraryless. Click here for Pure Java version (2827L/17K).

1  
sS regexpReplace_direct(S s, S pat, S replacement) {
2  
  Matcher m = regexp(pat, s);
3  
  ret regexpReplace_direct(m, replacement);
4  
}
5  
  
6  
sS regexpReplace_direct(Matcher m, S replacement) {
7  
  new StringBuffer buf;
8  
  while (m.find())
9  
    m.appendReplacement(buf, replacement);
10  
  m.appendTail(buf);
11  
  ret str(buf);
12  
}

Author comment

Began life as a copy of #1018263

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1021370
Snippet name: regexpReplace_direct - with direct replacement
Eternal ID of this version: #1021370/3
Text MD5: 25740a782dedf1e5488f6be1b349a131
Transpilation MD5: 3522ea83132618c7668440c59f9b2689
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-04-19 13:07:03
Source code size: 319 bytes / 12 lines
Pitched / IR pitched: No / No
Views / Downloads: 334 / 431
Version history: 2 change(s)
Referenced in: [show references]