<div id="rssConsumer" style="width:100%; border:1px solid #e8e8e8; margin:0px 0px 15px 0px;"><div style="margin:8px 10px 8px 10px; font-weight:bold; font-size:1.4em;">Recent Tweets</div>
<cffeed action="read" source="http://twitter.com/statuses/user_timeline/7717612.rss" name="tweetfeed">
</cffeed>
<cfloop from="1" to="3" index="i">
<cfoutput>
<div style="margin:8px 10px 8px 10px; padding:0px 0px 8px 0px; border-bottom:dotted; border-color:##CCC;">
<cfset noWharton = Right( #tweetfeed.item[i].title#, len(#tweetfeed.item[i].title#) - 9)>
<cfset newDate = Mid(#tweetfeed.item[i].pubdate#,5,12)>
#noWharton#<br />
#newDate#</div>
</cfoutput>
</cfloop>
<div style="margin:0px 10px 10px 10px;"><a href=http://twitter.com/wharton target="_blank">more »</a></div>
</div>
</div>
views:
51answers:
1
+1
A:
<cfloop from="1" to="3" index="i">
<cfif find("@", tweetfeed.item[i].title) eq 0 >
<cfoutput>
<div style="margin:8px 10px 8px 10px; padding:0px 0px 8px 0px; border-bottom:dotted; border-color:##CCC;">
#Right( #tweetfeed.item[i].title#, len(#tweetfeed.item[i].title#) - 9)#<br />
#Mid(#tweetfeed.item[i].pubdate#,5,12)#
</div>
</cfoutput>
</cfif>
</cfloop>
zarko.susnjar
2010-04-30 11:48:01
How would I use a substring to remove only tweets with @ as the first character?
Eric Sauers
2010-04-30 14:40:50
find will return index of an occurrence, in this case 1, right? So you need <cfif NOT (find("@", trim(tweetfeed.item[i].title)) eq 1)>
zarko.susnjar
2010-04-30 15:08:02
Sweet! Thanks your a life saver!
Eric Sauers
2010-04-30 15:14:28
left(tweetfeed.item[i].title,1) EQ "@" is more efficient. Also, cfoutput tag should be outside of cfloop.
Henry
2010-04-30 18:31:20
Acctually, if we are nitty-gritty xml looks like this, so neither solution is 100% correct:<item> <title>zarkosusnjar: @markosimic quote: "Don't worry, it only seems kinky the first time." :D</title>...Seems that in personal rss you never get @ at first place so:<cfif findNoCase(": @",tweetfeed.item[i].title)>would be easiest solution without using reg.expression.
zarko.susnjar
2010-04-30 19:30:02