Re: string modification
| From: | sven | Date: | Thu, 03 Jul 2003 10:24:10 +0000 |
| Subject: | Re: string modification | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-153857@lists.php.net to get a copy of this message | ||
thanks, this works.
ciao SVEN
Leif K-Brooks wrote:
>> hi,
>>
>> i didn't find a function for this in the manual, but maybe there is
>> one (or a workaround):
>>
>> does anyone have a solution for replacing multiple whitespaces with
>> a single whitespace whitin a string? similar to trim(). maybe a
>> regular expression?
>>
>> eg:
>> $string = 'word1 word2 word3';
>>
> $modified = preg_replace('|(\\s)+|','$1',$string);
>
>> $modified = 'word1 word2 word3';