Is there a standard function to remove multiple spaces from a string?
| From: | Henry | Date: | Fri, 09 Aug 2002 15:47:23 +0000 |
| Subject: | Is there a standard function to remove multiple spaces from a string? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-111831@lists.php.net to get a copy of this message | ||
Hi All,
Are there standard functions for removing multiple spaces (or even better
limiting contiguous space to specified lengths)?
i.e
foo("Hello peeps, happy times",1) -> "Hello peeps, happy times"
foo("Hello peeps, happy times",0) -> "Hellopeeps,happytimes"
foo("Hello peeps, happy times",2) -> "Hello peeps, happy times"
(notice single space between "," and "h")
Can I do it with reg exp?
TIA
Henry