Re: Checking a strings case

From: Date: Tue, 15 Apr 2003 06:23:42 +0000
Subject: Re: Checking a strings case
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-143870@lists.php.net to get a copy of this message
ext ODCS (odcs@rogers.com) wrote: > I'm trying to create a function to check a users input for "foul" language > and want to be able to check variations of case (i.e. CasE or cAsE). I have > checked out all the ereg and str* functions but not quite sure how to do > this. These "foul" words are in an array. I have it working now if a user > inputs 'case' or 'CASE'. Hi, This is how I would do it: 1. convert the dirtywords list to all lowercase, use tr, sed, perl, php, etc 2. use "strtolower($wordtocheck);" in your application 3. seach the dirtywords file for $wordtocheck BR, -- mike

« previous php.general (#143870) next »