Trying to write a function to get the first paragraph in a string. My test
string is:
<h2>Remove the a header</h2><p>This is the marigold following
the header. This is more.</p><p>This is another paragraph.</p>
The idea is two steps: Get everything to the LEFT of the </p> (this works),
then get everything to the right of the first <p> tag... this is working
strangely. Any thoughts? The trouble is in the Right extract.
function getFirstParagraph(str) {
str = trim(str);
endTag = findNoCase("</p>", str);
startTag = findNoCase("<p>", str);
if (endTag gt 0) {
endTag = endTag + 3;
extract = left(str, endTag);
} else {
extract = str;
}
if (startTag gt 0) {
startTag = startTag + 4;
extract = right(extract, startTag);
} else {
extract = str;
}
return extract;
}
</cfscript>
<cfoutput>#getFirstParagraph(comment)#</cfoutput>
Thanks
Robert Harrison
Director of Interactive Services
Austin & Williams
Advertising I Branding I Digital I Direct Â
125 Kennedy Drive, Â Suite 100 Â Â I Â Hauppauge, NY 11788
T 631.231.6600 X 119 Â Â F 631.434.7022 Â
http://www.austin-williams.com
Blog: http://www.austin-williams.com/blog
Twitter: http://www.twitter.com/austin_williams
-----Original Message-----
From: Rakshith N [mailto:[email protected]]
Sent: Wednesday, May 30, 2012 8:18 AM
To: cf-talk
Subject: ColdFusion Developer Week - 4th and 8th June, 2012
Hi All,
We are conducting the 2nd ColdFusion Developer week happening from 4th â 8th
June 2012. (Register here: http://adobe.com/go/cfdeveloperweek )
With the launch of ColdFusion 10, we are back with the 2nd ColdFusion
Developer Week, a series of free, live webinars hosted by seasoned ColdFusion
experts. The webinars cover a wide range of topics, from what ColdFusion is and
how to code it, to more in-depth topics related to CF10- HTML5, REST, ORM,
Security enhancements and more.
If you are a new developer, someone with little or no ColdFusion experience,
or even if you have been using ColdFusion all your life, these sessions are
ideal for you. The ColdFusion Developer Week provides something for everyone so
sign up now (http://adobe.com/go/cfdeveloperweek)
Thanks,
Rakshith Naresh
Product Manager - ColdFusion
Twitter: @rakshithn
Blog: http://blogs.coldfusion.com
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive:
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:351438
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm