ereg_replace for whitespace?
| From: | James Green | Date: | Mon, 21 Aug 2000 22:57:50 +0000 |
| Subject: | ereg_replace for whitespace? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-12834@lists.php.net to get a copy of this message | ||
Hi all,
So I need to remove all traces of whitespace from a string except for
single whitespaces...
Example:
from "this is too much whitespace you see "
to "this is too much whitespace you see "
the latter being the desired string
I was given
$fname = ereg_replace("\s+", " ", $userd[fname]);
as a suggestion, however it removes all 's'es from the string.
Can anyone suggest the correct recipe?
Many thanks.
--
James Green jg@linux.com
Programmer jg@bp2bp.com
Programmer, Manager jg@linuxnewbie.com