D&C Lug - Home Page
Devon & Cornwall Linux Users' Group

[ Date Index ][ Thread Index ]
[ <= Previous by date / thread ] [ Next by date / thread => ]

Re: [LUG] comma separated value string comparisons



Neil Williams wrote:

> $string1 = "PHP, XML, GnuPG, standards, design";
> $string2 = "C++, Perl, PHP, networking, security";
> 
> So $string1 should give a match with $string2.

Split the first one into a list and put it in a hash, keyed by word
with a value of 1 or true or soemthing.

Then split the second on and pile through it. If you get a match in
the hash you've got a match.

I'd not want to try and do the exmaple in PHP, but I could do it in
perl. 

Steve



--
The Mailing List for the Devon & Cornwall LUG
Mail majordomo@xxxxxxxxxxxx with "unsubscribe list" in the
message body to unsubscribe.


Lynx friendly