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

12
LINES

< > BotCompany Repo | #1008718 // replaceIC - replace element in list (ignoring case); also replace substrings

JavaX fragment (include)

1  
static L<S> replaceIC(L<S> l, S a, S b) {
2  
  new L<S> l2;
3  
  for i over l: {
4  
    S s = l.get(i);
5  
    l2.add(eqic(s, a) ? b : s);
6  
  }
7  
  ret l2;
8  
}
9  
10  
static S replaceIC(S s, S a, S b) {
11  
  ret s.replaceAll("(?i)" + patternQuote(a), quoteReplacement(b));
12  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1008718
Snippet name: replaceIC - replace element in list (ignoring case); also replace substrings
Eternal ID of this version: #1008718/5
Text MD5: 69bc498919408bad678a2cfbd514dcb2
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-10-31 04:45:41
Source code size: 259 bytes / 12 lines
Pitched / IR pitched: No / No
Views / Downloads: 595 / 635
Version history: 4 change(s)
Referenced in: [show references]