Forums / General / Strip \n characters from a string

Strip \n characters from a string

Author Message

Alejandro Serrano

Friday 22 September 2006 9:43:11 am

Hi,
I need to strip all '\n' and '\r' characters from a string, or replace it with a space. How can I do it with eZ Publish?

Thanks in advance.

Claudia Kosny

Friday 22 September 2006 1:41:50 pm

Hello Alejandro

I fyou just want to trim the string (i.e. remove whitespace from the beginning and of the string), use the trim operator. If you want to remove whitespace from the middle of the string you might need a preg_replace functionality, which is offered by this extension:

http://ez.no/community/contribs/template_plugins/reg_ex_replace

Greetings from Luxembourg

Claudia