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

8
LINES

< > BotCompany Repo | #1001929 // collapseWord - remove next-to-each-other duplicate/repeating characters from word; now IC

JavaX fragment (include)

1  
static S collapseWord(S s) {
2  
  if (s == null) ret "";
3  
  new StringBuilder buf;
4  
  for (int i = 0; i < l(s); i++)
5  
    if (i == 0 || !charactersEqualIC(s.charAt(i), s.charAt(i-1)))
6  
      buf.append(s.charAt(i));
7  
  ret buf.toString();
8  
}

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1001929
Snippet name: collapseWord - remove next-to-each-other duplicate/repeating characters from word; now IC
Eternal ID of this version: #1001929/8
Text MD5: b4df1c8e86da66e56d273e5b1d1c8922
Author: stefan
Category:
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-10-11 18:11:05
Source code size: 239 bytes / 8 lines
Pitched / IR pitched: No / No
Views / Downloads: 682 / 1367
Version history: 7 change(s)
Referenced in: [show references]