|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Be the architects of evolution and help create the mobile internet future. It’s your move---enter to win here! |
|
#1
|
|||
|
|||
|
Replace()
I read the macromedia docs, but they never really help me... I am wanting to replace any *br* on the page with <br> but i don't know what to set the string as
|
|
#2
|
|||
|
|||
|
<CFSET FOO = Replace(#BAR#, "<BR>", "br", "ALL")>
|
|
#3
|
|||
|
|||
|
I'm not sure how much more clear this can be. There's even an example at the bottom of the page. What more do you want?
__________________
Ask if you have a question, but also help answer questions that you have knowledge of! Thanks, Brian. How to Post a Question in the Forums |
|
#4
|
|||
|
|||
|
You don't have to be rude, this is a place where are are trying to get help. Being new to CF, no I do not understand that page.
'A string or a variable that contains one. String in which to search' I wanted to search the whole page, so i did not know what to put in the first spot. I tried putting <br> there sicne that's what I wanted replaced, and it gives the error "< marks the beginning of a ColdFusion tag.Did you mean LT or LTE?" I didn't know what else to try, considering the only examples they give are FORM examples - SORRY. mortisRider Thanks for the reply. I was just wondering where you got the #bar# variable from.. because it says it's undefined. Can i just stick this at the top of the page and it will replace them all? Thanks for the help. Quote:
Last edited by charmed0rz : April 6th, 2005 at 03:29 PM. |
|
#5
|
|||
|
|||
|
Uh, what exactly did I say that was rude? Why is it that you are so thin-skinned that my simply asking "what more do you want" is interpreted by you to be rude? I spend many hours each week answering questions here. Haven't I answered your questions on many occasions (including this one)?
And I hate to break this to you, but if you can't read that documentation page, look at the function arguments, read the example, and then have at least some idea of what the function does and how it works (enough to make some experimental attempts), then you are going to have a really hard time learning CFML (or any programming language for that matter...most are far more difficult than CFML). However, I don't think this is the case. I think you are smarter than that. I think you just didn't really look the docs over and attempt to figure out how the function works on your own. I am all for helping people when they need it, but I do expect people to read the docs and do some experimenting on their own before they run to the forum to ask a very simple question. Please, next time you have an issue, try to work through it yourself first and if it still doesn't work then post the experimental code that you tried and I or others will be happy to help. Last edited by kiteless : April 6th, 2005 at 09:14 PM. |
|
#6
|
|||
|
|||
|
Quote:
Back to the question, #bar# is whatever variable you want to do the replacing on. If you have a form variable that you want to replace, it would be #form.whatever#, if it is a query column it would be #myquery.whatever#. In other words, the function only runs on a string or a variable that contains a string...that means that whatever text you want to do the replace on must be fed into the function. If you want to do the replace on some generated content, you can look into using the <cfsavecontent> tag to capture the text into a variable, and you can then pass that variable into the replace() function. Something like: <cfsavecontent variable="theContent"> Here is some text. It might have a br in it. </cfsavecontent> <cfsavecontent variable="theBR"><br/></cfsavecontent> <cfset theContent = replaceNoCase( theContent, 'br', theBR, 'all' ) /> <cfoutput>#theContent#</cfoutput> Last edited by kiteless : April 6th, 2005 at 09:11 PM. |
|
#7
|
||||
|
||||
|
Roughing up noobs again Kiteless? lol
![]() |
|
#8
|
|||
|
|||
|
Only when provoked, Alas.
|
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > ColdFusion Development > Replace() |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|