[haXe] Neko lastIndexOf seems wrong?

Asger Ottar Alstrup asger at area9.dk
Thu Sep 21 17:52:04 CEST 2006


Hi,

Thanks for the hint. I have to pass length as the second parameter.

May I suggest to make the second parameter optional, like it is for indexOf,
and change the default value to length, rather than 0,as it is now?

    public function lastIndexOf( str : String, pos ) {
        untyped {
            var last = -1;
            if( pos == null )
                pos = 0;

Also, it would be nice with a comment in String.hx explaining that you have
to pass the length as second parameter for this to useful.

Finally, it seems the algorithm is O(n * m) which can be improved, but I can
like with that for now.

Regards,
Asger
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.motion-twin.com/pipermail/haxe/attachments/20060921/7dce4928/attachment.htm


More information about the Haxe mailing list