|
Posted by "Richard Lynch" on 10/29/05 22:41
On Sat, October 29, 2005 10:51 am, Minuk Choi wrote:
> function trim_text($text, $count)
> {
> $text = str_replace(" ", " ", $text);
> /*
> * This is redundant; you are replacing all " " in $text with " "
> * maybe you meant
> * $text = trim($text); ?
> */
It was probably replacing *TWO* spaces with one.
If so, it should really be in a while loop, because there could be 3
or more spaces in a row, and if the goal is only single-spaced
words...
//Replace 2 spaces with 1 until all words are single-spaced
while (strstr($text, ' ')) $text = str_replace(' ', ' ', $text);
PS
My post was doing 50 LETTERS, not 50 words.
So change 50 to 250 and call it done. :-)
Unless the word-count is really that critical...
--
Like Music?
http://l-i-e.com/artists.htm
Navigation:
[Reply to this message]
|