FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » reduce all spaces to one
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: reduce all spaces to one [message #176899 is a reply to message #176898] Fri, 03 February 2012 20:17 Go to previous messageGo to previous message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma:
Senior Member
On 2/3/2012 3:05 PM, crankypuss wrote:
> On 02/03/2012 12:36 PM, Jerry Stuckle wrote:
>> On 2/3/2012 2:03 PM, John wrote:
>>> Hello everybody,
>>>
>>> what would be in PHP the equivalent of the VB .NET statement
>>>
>>> Text = Regex.Replace(Text, "[ ]+", " ")
>>>
>>> in order to reduce to one all the spaces between words (chr(32)) ???
>>>
>>> Thanks for the hints.
>>>
>>>
>>
>> Try
>>
>> $text = preg_replace('/\s+/', ' ', $text);
>
> or,
>
> $text = str_replace(" ", " ", $text);
>

Doesn't work - try it with 'abc def ghi jkl'.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Stats comp.lang.php (last 7 days)
Next Topic: Check email
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sat Nov 23 11:34:03 GMT 2024

Total time taken to generate the page: 0.05110 seconds