Re: removing text from a string

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 6 Nov 2008, at 18:33, Thodoris wrote:
This :

ltrim($line, '0123456789 .');


does remove all those characters doesn't it (as the OP asked and Richard suggested on a previous thread). Without calling it more than once as far as I tested. That was my point on the first place and sorry if I didn't make that clear. On the other hand who ever suggested calling ltrim without the second parameter.

You suggested before something like that:

ltrim(ltrim(ltrim($line, '0123456789'), '.'))


when you made a comparison didn't you?

Sorry if I got that wrong I meant no offense and I still don't.

That doesn't meet the objectives. Consider that $line might be "1. 100 apples". Your solution has reduced it to "apples" rather than the required "100 apples".

Calling it three times as was suggested will produce the correct result.

-Stut

--
http://stut.net/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux