perl-unicode

Unicode::Collate string replacements and case sensitivity

2011-04-29 04:22:51
dear all,
I'm trying to do some string replacements with Unicode::Collate which
usually work very well, but these replacements seem to be case
insensitive by default - how can I change this? look at this simple
example:

my $myCollator = Unicode::Collate->new( normalization => undef, level
=> 1 );
my $str = "Camel camel donkey zebra came\x{301}l CAMEL horse
cAmEL...";
$myCollator->gsubst($str, "camel", sub { "#$_[0]#" });

which makes the following replacements:

#Camel# #camel# donkey zebra #camél# #CAMEL# horse #cAmEL#...

what I would love to see is the following result:

Camel #camel# donkey zebra #camél# CAMEL horse cAmEL...

As there doesn't seem to be gsubst for case sensitive and gisubst for
case insensitive string replacements, what would a solution look like?

Thanks a lot for any suggestions,
Frank

<Prev in Thread] Current Thread [Next in Thread>
  • Unicode::Collate string replacements and case sensitivity, Frank Müller <=