Re: perl / Umlaute ersetzen

Andre Heine <[email protected]>
Newsgroups gmane.linux.suse.programming
Organization none
Message-ID <[email protected]>
Moin moin!


Am Mittwoch, 18. April 2007 schrieb Hans Moser:
> my %UMLAUTE = ( 'Ä' => 'Ae', 'Ö' => 'Oe', 'Ü' => 'Ue', 'ä' => 'ae',
> 'ö' => 'oe', 'ü' => 'ue' );
> my @UMLKEYS = join("|", keys(%UMLAUTE));
> $du_name =~ s/(@UMLKEYS)/$UMLAUTE{$1}/g;
>
> $du_name bleibt wie es ist, mit Umlauten. :(

use warnings;
use strict;

my $string = 'Glückspilz';


my %UMLAUTE = ( 'Ä' => 'Ae', 'Ö' => 'Oe', 'Ü' => 'Ue', 'ä' 
=> 'ae', 'ö' => 'oe', 'ü' => 'ue' );

$string =~ s/(ä|Ä|ü|Ü|ö|Ö)/$UMLAUTE{$1}/g;


print $string,"\n";


HTH

Andre
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.