This bit of code will do the job:
$string =~ s/(.)\1/$1/gAlternatively, if you want to ignore case when comparing, you could use:
$string =~ s/(.)\1/$1/giAnd finally, if you wanted to trim any number of duplicates down to a single letter, this would work:
$string =~ s/(.)\1+/$1/giIn reply to Re: Remove repeated characters from a string
by knew
in thread Remove repeated characters from a string
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |