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 #176908 is a reply to message #176903] Sat, 04 February 2012 21:26 Go to previous messageGo to previous message
John is currently offline  John
Messages: 18
Registered: September 2010
Karma:
Junior Member
Am 04.02.2012 15:41, schrieb Thomas 'PointedEars' Lahn:

>
> It should be noted that if your question was understood literally, the
> solutions presented so far would be wrong. \s would match too many
> different characters, as it stands for *white-space* in PCRE, _not_ only the
> space character. In order to reduce only all consecutive *space* characters
> to one space character, you need to write
>
> echo preg_replace('/ +/', ' ', "here are some \n spaces ");
>
> Note that the newline, which is white-space too, is preserved here.
>

in fact, just by 'accident' the 'regex' solutions fits perfectly in what
I have to do next, i.e. feed the text through an 'explode' statement,
which takes ' ' as separator.
[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 13:28:19 GMT 2024

Total time taken to generate the page: 0.04780 seconds