[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [FWP] Quick hack for common length



On Tue, 26 Jun 2001 14:37:51 +0530, Abhijit Menon-Sen wrote:

>Todd Olson spoke about this at YAPC 19100:
>
><URL:http://www.people.cornell.edu/pages/tco2/papers/common_leading_substring/>
>
>(For what it's worth, the $a^$b =~ m/^\0+/ solution was the fastest he
>found, as well.)

A problem that this solution doesn't solve, is with strings containing
"\0" characters. For example, "a\0\0\0" and "a" would appear to have a
common leading substring with a length of 4, that is: longer than the
shortest string of the two. (In addition, if one of the strings is
actually a number, you're in trouble.)

The proposed solution in C has a similar problem (as always) in that a
string cannot even contain a null byte.

-- 
	Bart.

==== Want to unsubscribe from Fun With Perl?  Well, if you insist...
==== Send email to <fwp-request@technofile.org> with message _body_
====   unsubscribe