Remove Spaces from Middle of String
| From: | Kevin Murphy | Date: | Tue, 03 Oct 2006 18:08:23 +0000 |
| Subject: | Remove Spaces from Middle of String | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-242561@lists.php.net to get a copy of this message | ||
This works, but I was wondering if this was the best way to accomplish this or not. I'm trying to remove any extra spaces (not whitespace like carriage returns) from the middle of a string.... mainly for times where people put extra spaces after periods in paragraph.
while(preg_match('/ /',$data))
{ $data = str_replace(" "," ",$data); }
Is there a better way to accomplish this same task? (PHP 4.x). Thanks.
--
Kevin Murphy
Webmaster: Information and Marketing Services
Western Nevada Community College
www.wncc.edu
775-445-3326