Forums / Setup & design / remove CRLF (\r\n) caracters

remove CRLF (\r\n) caracters

Author Message

Lydie Soler

Wednesday 14 December 2005 9:42:05 am

Hi,

does someone knows a way to remove the CRLF (\r\n) caracters from a string?

I have tried almost all the string function but it doesn't seems to work.
here is an example of what I would like:
I have

 line 1
line 2

I would like to have

 line1 line2

I didn't find a replace function or something like this. Thanks a lot for your help! This caracters makes my javascript bug!

Thanks again for your help

Ole Morten Halvorsen

Wednesday 14 December 2005 11:23:01 am

Did you try the <b>trim()</b> operator?

http://ez.no/doc/ez_publish/technical_manual/3_6/reference/template_operators/strings/trim

Senior Software Engineer - Vision with Technology

http://www.visionwt.com
http://www.omh.cc
http://www.twitter.com/omh

eZ Certified Developer
http://ez.no/certification/verify/358441
http://ez.no/certification/verify/272578

Ole Morten Halvorsen

Wednesday 14 December 2005 2:25:05 pm

My bad. Didn't see you wanted to remove newline characters from the middle of the string :)

I think you would have to make your own operator that does the removal for you.

Senior Software Engineer - Vision with Technology

http://www.visionwt.com
http://www.omh.cc
http://www.twitter.com/omh

eZ Certified Developer
http://ez.no/certification/verify/358441
http://ez.no/certification/verify/272578

Lydie Soler

Thursday 15 December 2005 12:50:36 am

hi!

yes I have tried the trim operator and as you noticed my problem is with removing caracters in the middle of the string.

ok lets try to create my own... But how do I do this?... where do I have to put my new code....

where can I find the code of the trim operator in order to have an example?

thanks again!!!

Lydie Soler

Thursday 15 December 2005 1:55:01 am

Well I have search.. and I have found an extension that does exactl what I needed: str_replace.

so here is the code that works for my needs:

{set $corps=ezstr_replace("\r","",$corps)}
{set $corps=ezstr_replace("\n","<br/>",$corps)}

Ole Morten Halvorsen

Thursday 15 December 2005 4:12:24 am

That's great.

Didn't know there was a string replace operator available as a contribution :)

Senior Software Engineer - Vision with Technology

http://www.visionwt.com
http://www.omh.cc
http://www.twitter.com/omh

eZ Certified Developer
http://ez.no/certification/verify/358441
http://ez.no/certification/verify/272578

eZ debug

Timing: Jan 17 2025 21:53:15
Script start
Timing: Jan 17 2025 21:53:15
Module start 'content'
Timing: Jan 17 2025 21:53:17
Module end 'content'
Timing: Jan 17 2025 21:53:17
Script end

Main resources:

Total runtime1.7530 sec
Peak memory usage4,096.0000 KB
Database Queries203

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0075 587.7109180.8359
Module start 'content' 0.00751.5431 768.5469536.4531
Module end 'content' 1.55050.2024 1,305.0000338.1328
Script end 1.7529  1,643.1328 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00440.2530210.0002
Check MTime0.00190.1064210.0001
Mysql Total
Database connection0.00090.050310.0009
Mysqli_queries1.636893.37002030.0081
Looping result0.00250.14122010.0000
Template Total1.709397.520.8547
Template load0.00230.131620.0012
Template processing1.707097.374120.8535
Template load and register function0.00020.012910.0002
states
state_id_array0.00210.118910.0021
state_identifier_array0.00490.280320.0025
Override
Cache load0.00180.1033320.0001
Sytem overhead
Fetch class attribute can translate value0.00230.130130.0008
Fetch class attribute name0.00110.063560.0002
XML
Image XML parsing0.00060.032130.0002
class_abstraction
Instantiating content class attribute0.00000.000760.0000
General
dbfile0.03532.0135210.0017
String conversion0.00000.000430.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

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
6content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
9content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
1content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
3content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 21
 Number of unique templates used: 6

Time used to render debug report: 0.0002 secs