Longest common prefix: Difference between revisions

Content added Content deleted
(→‎Perl 6: don't trim strings from the end, use lazy .ords instead)
m (→‎{{header|Perl 6}}: formatting)
Line 203: Line 203:
<lang perl6>multi lcp() { '' }
<lang perl6>multi lcp() { '' }
multi lcp($s) { ~$s }
multi lcp($s) { ~$s }
multi lcp(*@s) { substr @s[0], 0, first-index *.not, [Zeqv] |@s».ords;
multi lcp(*@s) { substr @s[0], 0, first-index *.not, [Zeqv] |@s».ords }
}


use Test;
use Test;