in reply to Matching double characters and insertion
----------------------------------------------------- Dr. Michael K. Neylon - mneylon-pm@masemware.com || "You've left the lens cap of your mind on again, Pinky" - The Brainmy @array = split //, $string; my @newarray; my $c = shift @array; while ( @array ) { my $d = shift @array; push @newarray, $c; if ( $c eq $d ) { push @newarray, 'x'; } $c = $d; } push @newarray, $c; $string = join '', @newarray; #update
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Matching double characters and insertion
by japhy (Canon) on Jul 20, 2001 at 06:05 UTC |