Skip to main content
Inspiring
June 22, 2006
Question

Removing Carriage Returns

  • June 22, 2006
  • 3 replies
  • 2811 views
I have a table with a field that contains data such as this, and I want to remove all of the carriage returns but I am having difficultiy. I have tried replacing the chr(13) and the chr(10) but no such luck. Can anyone help? Thanks!

==== start of code block ====

Part Number: 1307 G9<BR>



Finish Family:






CHROMES<BR>




Finish/Color:






STERLING NICKEL<BR>




Dimensions:






1 1/4 INCH DIAMETER<BR>




Collection:






BRASS & STERLING TRADITIONS<BR>

==== end of code block====
    This topic has been closed for replies.

    3 replies

    Inspiring
    June 24, 2006
    Hi,

    For me both database as well as coldfusion worked fine. You may also please try with small example.

    Method 1:
    ***********
    At database side
    select
    replace(columnname,chr(13)||chr(10),' ') as columnname
    from <tablename>

    Method 2: Coldfusion
    ***********************
    <cfset pageContent = reReplace(pageContent, chr(10)&chr(13),"", "all" )>

    I noticed that the regular expression functions in CF support the newline character \n Chr(10), carriage return \r Chr(13), and tab \t Chr(9).

    <cfsavecontent variable="data">
    here is my
    break
    </cfsavecontent>

    <cfoutput>#ReReplace(data, "\n", "<br />", "ALL")#</cfoutput>

    Method 3: Coldfusion.
    *************************
    Please go through the below article. Example is mentioned
    http://livedocs.macromedia.com/coldfusion/6/CFML_Reference/functions-pt248.htm

    Hope this helps. Please try it out.

    Satheesh.
    Inspiring
    June 22, 2006
    Try these two:
    ParagraphFormat(your_var)
    StripCR(your_var)
    Participating Frequently
    June 22, 2006
    Have you tried using cfprocessingdirective?

    Specifies whether to remove excess whitespace character from ColdFusion generated content in the tag body.
    Identifies the character encoding (character set) of the page contents.

    <cfprocessingdirective
    suppressWhiteSpace = "yes" or "no"
    pageEncoding = "page-encoding literal string">
    CFML tags
    </cfprocessingdirective>


    Phil