B
Bill Kelly
Hi,
Is there any ruby built-in that might tell me how
many characters match (are in common) from the start
(left) of two strings? E.g.
"abcxxxxxx".lcommon("abcdezzzzz") # => "abc" (or 3)
All I need is the length but a substring would be
fine too.
Figured I'd ask in case I'd overlooked a nicer way
to do this than writing a loop.
Thanks,
Regards,
Bill
Is there any ruby built-in that might tell me how
many characters match (are in common) from the start
(left) of two strings? E.g.
"abcxxxxxx".lcommon("abcdezzzzz") # => "abc" (or 3)
All I need is the length but a substring would be
fine too.
Figured I'd ask in case I'd overlooked a nicer way
to do this than writing a loop.
Thanks,
Regards,
Bill