note 68735 added to function.strtolower
| From: | eduardor2k at redr2k dot com | Date: | Tue, 08 Aug 2006 21:34:19 +0000 |
| Subject: | note 68735 added to function.strtolower | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-115705@lists.php.net to get a copy of this message | ||
I changed it a bit and i found that it's better to put everything in lowercase, and rebuild the
text the same way a teacher corrects a text, for now it only checks that the first letter after a
point "." must be
in upper case.
function RemoveShouting($string)
{
$string = strtolower(trim($string));
for($i=0;$i<strlen($string);$i++){
if($i==0){$string[$i] = strtoupper($string[$i]);}
if($string[$i] == "."){
while($string[$i+1] == " "){
$i++;
}
$string[$i+1] = strtoupper($string[$i+1]);
$i++;
}
}
return $string;
}
this function would change:
Hi mi name is PETER. SOME TIMES I FORGOT TO DISABLE CAPS LOCK.
into:
Hi mi name is peter. Some times i forgot to disable caps lock.
----
Server IP: 130.206.1.5
Probable Submitter: 213.60.190.240
----
X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER
autolearn=no version=2.64
----
Manual Page -- http://www.php.net/manual/en/function.strtolower.php
Edit -- https://master.php.net/note/edit/68735
Del: integrated -- https://master.php.net/note/delete/68735/integrated
Del: useless -- https://master.php.net/note/delete/68735/useless
Del: bad code -- https://master.php.net/note/delete/68735/bad+code
Del: spam -- https://master.php.net/note/delete/68735/spam
Del: non-english -- https://master.php.net/note/delete/68735/non-english
Del: in docs -- https://master.php.net/note/delete/68735/in+docs
Del: other reasons-- https://master.php.net/note/delete/68735
Reject -- https://master.php.net/note/reject/68735
Search -- https://master.php.net/manage/user-notes.php