Replace(#message#, '#', '##') - Why error?

Ask a Question related to Coldfusion - Advanced Techniques, Design and Development.

  1. #1

    Default Replace(#message#, '#', '##') - Why error?

    <!--- MESSAGE is generated by online visual html editor in this format (message
    - <font color="#FF0000">hello word</font>) --->

    <!---I do the following --->
    <cfset message = JSStringFormat(#message#)>
    <!--- Now MESSAGE in this format (message - <font color=/"#FF0000/">hello
    word</font>) --->

    <!--- Next i want --->
    <cfoutput>#message#</cfoutput>
    <!--- But I receive a mistake Because of - # - --->

    <!---I do the following --->
    <cfset message=Replace(#message#, '#', '##')>
    <!--- But I receive a mistake too --->

    How competently to make replacement in my case??

    Newyork_az Guest

  2. Similar Questions and Discussions

    1. How To Supress Acrobat Error Message And Alert Message
      Is there any way to supress those pop up message? If can't, is there any way to catch it?
    2. Error Message When Sending Message In Windows Mail
      Am I the only one getting an error message when replying to a posted message using Windows Mail. Every time I send a message I get a popup error...
    3. Error Message "A drawing error ocurrred which is probably due to an out-of-memory condition. Try qu
      I am running Acrobat Reader 5.0 on a Mac Powerbook running OS 9.2 and keep getting "A drawing error occurred which is probably due to an out of...
    4. Search and replace (super global replace)
      I am using the 30 day trail of acrobate professional....before I buy it I have a few questions.... 1) is there a "search and replace" function...
    5. syntax error in replace statement
      What's wrong with this code? strLongDesc = Replace(Replace(Replace(Replace(Trim(Request.Form("LongDesc")),"'","''"),vbC...
  3. #2

    Default Re: Replace(#message#, '#', '##') - Why error?

    Put your #message# in double quotes like so ...

    "#message#"

    that should correct the problem
    aminz Guest

  4. #3

    Default Re: Replace(#message#, '#', '##') - Why error?

    Try:
    <cfset message=Replace(#message#, '##', '####')>

    OldCFer Guest

  5. #4

    Default Re: Replace(#message#, '#', '##') - Why error?

    Thanks for advice
    Well whereas to be here?
    <cfset message=Replace("<font color=#FF0000>hello word</font>", '##', '####')>
    How to make replacement then to draw a conclusion without mistakes
    If already at replacement the mistake leaves?

    Newyork_az Guest

  6. #5

    Default Re: Replace(#message#, '#', '##') - Why error?

    > <cfset message=Replace("<font color=#FF0000>hello word</font>", '##', '####')>

    Simple rule in CF.

    In a CF statement, if you're using a # symbol literally (ie: not in the CF
    "evaluate as a variable" sense, but just as the # character), then you have
    to escape it.

    So you'd need to do this:
    <cfset message=Replace("<font color=##FF0000>hello word</font>", '##',
    '####')>

    Otherwise you're telling CF: "evaluate the expression that is

    #FF0000>hello word</font>", '#

    Which obviously doesn't make sense.

    I can't make out from what you've posted what you're actually trying to
    achieve here.

    Don't tell us a story, just post the actual code.

    --

    Adam
    Adam Cameron Guest

  7. #6

    Default Re: Replace(#message#, '#', '##') - Why error?

    You cannot understand that this line <font color = #FF0000> hello word</font>
    is generated by Online visual html editor
    and I cannot change in it in manual.
    I need to make replacement with program way.
    There is a decision?

    Newyork_az Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139