[TYPO3-core] RFC #9879: enable charlist for trim function in stdWrap

Dmitry Dulepov dmitry at typo3.org
Thu Dec 4 17:46:16 CET 2008


Hi!

Georg Ringer wrote:
> Dmitry Dulepov wrote:
>> $content = trim($content, trim($conf['trim.']['charList'], '|'));
> 
> nice and a +1 but nitpicking: can this still trim | ?

He-he, you caught me ;) It can trim | only if spelled like | | |.

I could also propose something like:

$content = trim($content, preg_replace('/^(\|)?(.*)\1/', '\2', $conf['trim.']['charList']));

preg_replace produces the following:

| => |
|| =>
|abc| => abc
abc| => abc|

Sometimes I feel like doing programming exercises :D Not bad to train the brain though :)

-- 
Dmitry Dulepov
TYPO3 core team
In the blog: http://typo3bloke.net/post-details/zend_debugger_goes_64_bit_on_mac_os_x/
My TYPO3 book: http://www.packtpub.com/typo3-extension-development/book


More information about the TYPO3-team-core mailing list