Since this thread is running I would like to know the gurus' opinons on the
similar following situation

Suppose there is a variable like this

$var = "This is a variable          ";

Now I want to strip off white spaces on the end without losing them in the
middle of the sentence ..


I had figured that there is a no direct way of doing it and some thing like
this 
works
$var = trim (ereg_replace("  ","",$var));

the first argument to ereg_replace is  "two spaces" so that single spaces
between the words are not removed
then trim to remove any space on the end which may still remain.

But I feel its still not a fool proof solution because there may be two
spaces in between words some where also
which will then be clubbed together. 

Any body has a better idea.

Jaskirat





At 09:51 PM 2/16/01 -0500, you wrote:
>> Trim() will in fact only strip whitespace from the beginning or end of
>> the string; if he has \n's anywhere in the middle of the string, trim
>> will do perform the desired operation.
>
>CORRECTION : "trim will not perform the desired operation"
>
><snip>
>
>-- 
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to