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)

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

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: 602 / 1285
Version history: 7 change(s)
Referenced in: [show references]