note 87267 deleted from function.trim by danbrown
| From: | danbrown@php.net | Date: | Thu, 27 Nov 2008 17:09:49 +0000 |
| Subject: | note 87267 deleted from function.trim by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-147045@lists.php.net to get a copy of this message | ||
Note Submitter: chenzya at gmail dot com
----
a more compact version ;)
function TrimStr($str) {
$str = trim($str);
for($i=0;$i < strlen($str);$i++) {
if($str{$i} != " ")
$ret_str .= $str{$i};
else {
while($str{$i} == " ") $i++;
$ret_str.= " ";
$i--;
}
}
return $ret_str;
}