On Tue, May 08, 2012 at 05:19:40AM +0200, Frederik Schwarzer wrote:
> Hi,
>
> I had a little problem with rindex and wrote a small demo code that
> shows what I found.
>
> The code is:
> use v6;
>
> my $string = "perl";
> say $string;
> say $string.WHAT;
> say $string.index("e");
> say $string.rindex("e");
>
> say "";
> say @*ARGS[0];
> say @*ARGS[0].WHAT;
> say @*ARGS[0].index("e");
> say @*ARGS[0].rindex("e");
>
> When run, I see the following (with a two-week old build of Rakudo
> master):
> $ perl6 index.pl perl
> perl
> Str()
> 1
> 1
>
> perl
> Str()
> 1
> Failure.new(exception => X::AdHoc.new(payload => "substring not
> found"))
>
> Do I miss something? Any help is appreciated.

$ install/bin/perl6 -e 'say 
nqp::p6box_s(pir::encodingname__SI(pir::encoding__IS(@*ARGS[0])))' perl
utf8

$ install/bin/perl6 -e 'say 
nqp::p6box_s(pir::encodingname__SI(pir::encoding__IS("perl")))' perl
ascii

$ install/bin/perl6 -e 'say "perł".rindex("e");' perl
substring not found
  in method gist at src/gen/CORE.setting:8140
  in sub say at src/gen/CORE.setting:6244
  in block <anon> at -e:1

$ install/bin/perl6 -v
This is perl6 version 2012.03-27-g5793035 built on parrot 4.2.0 revision 
RELEASE_4_2_0


rindex appears to not like utf-8 encoded strings very much.

-Stefan

Attachment: signature.asc
Description: Digital signature

Reply via email to