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: 683 / 1367
Version history: 7 change(s)
Referenced in: #1002427 - Accellerating 629 (SPIKE)
#1006654 - Standard functions list 2 (LIVE, continuation of #761)
#1011014 - maxRunlengthOfRepeatingChars
#3000382 - Answer for ferdie (>> t = 1, f = 0)
#3000383 - Answer for funkoverflow (>> t=1, f=0 okay)