On Thu, Jan 17, 2008 at 10:57:11AM +0100, Moritz Lenz wrote:
> what happens if some of the characters aren't cased at all, like white
> spaces?
> 
> my $str = "AB DE";
> $str ~~ s:ii/.*/abcde/;
> 
> is the result ABcDE ? or is the space ignored and the substition is
> performed as if $str was "ABDE" in the first place?

I think chars in the target string should be left alone when the
corresponding pattern char is uncased, so I vote for "ABcDE".

> my $str = "määh";
> $str =~ s:bb/.*/mo i/;
> 
> is $str now 'mö i' ? Or does the space get a \N{COMBINING DIAERESIS}? Or
> is it tranlated to \N{DIAERESIS}? What about other non-letter characters?

This case is actually pretty clear, combining codes will combine with
space (0020), in fact that's the canonical way to display them on their
own.  And in graph mode, Perl 6 will consider a space with COMBINING
DIAERESIS and a plain DIAERESIS to be the same character, because their
representations in NFD are the same.

A hard case would be \n instead of space, because combining chars won't
combine with it - "\n\N{COMBINING DIAERESIS}" is two graphemes.  I'm not
sure what samebase should do in that case.

-ryan

Reply via email to