For an exhaustiv brute force partial match, between string 1 and
string 2. Take the first string and break it up in segment of
lenght 1,2,3,...,n-1, where n is the lenght of string 1.
Then for each of these segment do a "string-find-in-string"
in the second string - if you get a hit, then you have a
partial match.
//Anders - doesn't pople read Knut anymore?
-----Original Message-----
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: 4/1/2004 2:59 PM
Subject: [PHP-WIN] STUCK : String Comaparison
I may be just over thinking this but I'm stuck trying to figure out a
solution that has to deal with comparing a series of dynamic strings to
a
known string. The strings will be 8 characters long and each character
will be either a zero or a 1. What I need to do is to compare the
dynamic
strings with the known and if each of the 1 characters in the dynamic
string aligns with the 1 characters in the known string it will throw a
flag. The dynamic string does NOT need to contain all of the 1
characters
that the known string does, just that the ones that it contains align.
Examples:
Known:
10100010
Dynamic:
00100000 Throws flag because both strings contain a 1 in position 3
01100000 Doesn't throw flag because there is a 1 in position 2
10100000 Throws a flag because the 1s in position 1 and 3 align
10110000 Doesn't throw a flag because of the 1 in position 4
I was able to create a function that matches the entire string but I
lost
it when trying to deal with partial matches. Does anyone have a
potential
solution for such a beast? I appreciate any input you might be able to
offer...
Thanks,
Ron
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php