STUCK : String Comaparison
| From: | Ron dot Herhuth at tatumpartners dot com | Date: | Thu, 01 Apr 2004 12:59:42 +0000 |
| Subject: | STUCK : String Comaparison | ||
| Groups: | php.windows | ||
| Request: | Send a blank email to php-windows+get-23335@lists.php.net to get a copy of this message | ||
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