May 7, 2009 at 5:33am
text="Mostly Cloudy" code="28" temp="9" date="Thu, 7 May 2009 5:50 am BST"
Is there anyway i can grab the values of each element? (ie: grabbing the data between the quotes whilst keeping the formating)
May 7, 2009 at 9:29am
You could split the text up based on the quotation marks. But quotation marks are a bit tricky. In my script I’ve escaped them, before they are splitted into an array. Then all the odd-valued indexes ar sent out the right outlet.
This is not a very good solution, but since I was doing something similar myself, I had to have a go;)
var someText = “text=”Mostly Cloudy” code=”28″ temp=”9″ date=”Thu, 7 May 2009 5:50 am BST”" //the quotation marks needs to be escaped, so this isn’t really a clever way to do this
var splitList = report.split(/x22/g); //this splits the text using a regex with a modifier set to “global”
May 7, 2009 at 12:09pm
Absolutely brilliant, works really well, thanks
You must be logged in to reply to this topic.