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

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 18 2025 19:24:28
Script start
Timing: Jan 18 2025 19:24:28
Module start 'layout'
Timing: Jan 18 2025 19:24:28
Module start 'content'
Timing: Jan 18 2025 19:24:28
Module end 'content'
Timing: Jan 18 2025 19:24:28
Script end

Main resources:

Total runtime0.7319 sec
Peak memory usage4,096.0000 KB
Database Queries54

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0056 589.0313152.6250
Module start 'layout' 0.00560.0038 741.656339.4453
Module start 'content' 0.00940.7209 781.1016456.1016
Module end 'content' 0.73040.0015 1,237.20318.1563
Script end 0.7318  1,245.3594 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00340.4598160.0002
Check MTime0.00130.1748160.0001
Mysql Total
Database connection0.00060.079310.0006
Mysqli_queries0.690694.3567540.0128
Looping result0.00050.0738520.0000
Template Total0.701295.820.3506
Template load0.00220.302420.0011
Template processing0.699095.506820.3495
Template load and register function0.00020.026910.0002
states
state_id_array0.00080.116110.0008
state_identifier_array0.00110.150720.0006
Override
Cache load0.00170.2391120.0001
Sytem overhead
Fetch class attribute can translate value0.00060.084620.0003
Fetch class attribute name0.00190.256020.0009
XML
Image XML parsing0.00020.033220.0001
class_abstraction
Instantiating content class attribute0.00000.000920.0000
General
dbfile0.00060.0880100.0001
String conversion0.00000.001340.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
2content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
1content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
2content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 7
 Number of unique templates used: 5

Time used to render debug report: 0.0002 secs