Re: remove whitespace
| From: | David Otton | Date: | Wed, 08 Nov 2000 10:03:24 +0000 |
| Subject: | Re: remove whitespace | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-24288@lists.php.net to get a copy of this message | ||
On Wed, 8 Nov 2000 13:24:16 +1030, nick.a.wilson@baesystems.com wrote:
>> -----Original Message-----
>> From: David Otton [mailto:djo@jawbone.freeserve.co.uk]
>> Sent: Wednesday, 8 November 2000 10:47
>> To: php-general@lists.php.net
>> Subject: [PHP] remove whitespace
>> I want to remove extraneous whitespace-like characters from a string,
>$string = preg_replace("/[\w]+/i", " ", $string);
Ok, thanks, I've checked the manual, and I assume you mean "/[\s]+/i"?
Also, the manual page for trim() defines whitespace as '\n', '\r',
'\t', '\v', '\0' or ' ', but preg_replace() seems to treat
'\0' as an
end-of-string character. Does anyone know if this is a bug or an
inconsistency?