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 #176910 is a reply to message #176909] Sun, 05 February 2012 00:39 Go to previous messageGo to previous message
John is currently offline  John
Messages: 18
Registered: September 2010
Karma:
Junior Member
Am 05.02.2012 00:05, schrieb Thomas 'PointedEars' Lahn:
>
> I do not think you have fully understood what I have said (maybe you want to
> try posting to *de*.comp.lang.php instead?). *All* presented solutions so
> far, including yours and mine, are "'regex' solutions". But the set of
> characters that are replaced differs between them.
>

Thanks for the suggestions and advice : however I hope my english is
adequate enough to make myself understood in this NG :-))

>
> $words = str_split(' ', preg_replace('/\\s+/', ' ', $text));
>

I have the problem of 'filtering' a text file, exported from Excel as a
'Windows text file with <return>', containing <tabs> between numbers.
So, besides converting all comma to points, I have to get rid af all
<tabs> and after that, reduce all spaces between words to one space.

So far its working : I have used the preg_split first with /\t/ then
/\s+/ in two separate steps. No problem so far.
If they arise, I'll come back again.

>
> You might also want to exclude periods (`.') and other punctuation from
> words,

I can't. I need the numbers and they may be decimals with points.

> You might find [5] useful, in particular [6], for the next time that you
> post (translations are available there).
>

Thanks very much indeed for the most exhaustive answer ! I am happy
I've found this place.

Thanks and best regards to all who contributed to the thread.

John.
[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: Wed Nov 27 03:06:11 GMT 2024

Total time taken to generate the page: 0.04480 seconds