[thelist] Two XHTML validity questions in a CF site

Bruce Heerssen bheerssen at visualbridge.tv
Thu Jul 12 11:40:02 CDT 2001


Bruce Heerssen wrote:

> Maybe you could use "replace('your_string', chr(10), '<br />' 'All')"? 
> You could also use "chr(13)". You just need to replace the new line or 
> carriage return delimiter (or both if you want to be picky) with the 
> <br /> tag. Then wrap the entire contents in <p></p> tags.
>
There's a typo there, sorry. Here's the correct version:

replace('your_string', chr(10), '<br />', 'All')

It was missing a comma.

As an extension to this idea, you could use ReReplace().

<cfset your_string_variable = rereplace(your_string_variable, 
"[#chr(10)##chr(13)#]", "<br />", "all")>

This would replace all occurances of chr(10) or chr(13) with <br />

Here is my test code for you to examine:

<cfset teststring = "test" & chr(10) & chr(13) & "test" & chr(10) & 
"test" & chr(13) & "test">
<cfset teststring = rereplace(teststring, "[#chr(10)##chr(13)#]", "<br 
/>", "all")>
<cfoutput>#teststring#</cfoutput>

HTH,

Bruce







More information about the thelist mailing list