Stripping HTML
Some while ago I was asked to build a flash widget that used an XML feed as its datasource. Annoyingly, the XML feed had html tags in there to format the data. Curses! So I wrote this little actionscript function to strip the HTML. It works in javascript too and I've re-used it a few times since....
function stripHtml(str) {
while ((str.indexOf('<')!=-1) && (toStrip.indexOf('>')!=-1)) {
str = str.slice(0,str.indexOf('<')) + str.slice((str.indexOf('>') + 1),str.length);
}
return str; }
Latest Posts
iPhone App: Flick Cricket
10:15a.m., 4 Sep
Cricket seems like a ridiculous sport to me. I like hitting the ball - hitting a ball as hard as ...Javascript from the wonderful world of online advertising
8:23p.m., 1 Sep
I had a right old rant about the quality of javascript that you find being served by major providers of ...Web performance - Analysing Heart.co.uk
5:17p.m., 26 Aug
A few weeks back I, together with m'colleague Jon Topper, delivered a presentation about the performance of heart.co.uk to the ...Installing MySQL and MySQLdb on OSX
10:19a.m., 19 Aug
I've just set up my dev environment for Django. Again. This is the fourth time I've had to do it. ...