Twitter has a super easy way of updating twitter statuses via URL, but the awesome Wez Crozier and I came across some issues. But first to how you do this:
var url:String = "http://twitter.com/home?status=";
First note: do not try www.twitter.com, because it will not work. Your escaped items (mainly Hashtags # == %23) will not be unescaped for you. Props to Wez for that one.
Here's some awesome RegEx code Wez figured out for me too (I suck at RegEx):
var textToPostToTwitter:String = postText.text;
var input:String = url+textToPostToTwitter;
var output:String = input.replace(new RegExp(/\s/g), "+");
output = output.replace(new RegExp(/\#/g), "%23");
Something that I figured out because I was trying to be lazy and sneaky was that you have to replace the whole String. I mean you can't just replace the String you want as the status and do a url + input.replace(new RegExp(/\s/g), "+");.
So, I hope that helps some of you guys not fall into the trap we did. And thanks again Wez, you rock.
Follow Wez at: twitter.com/obwez
And use Grant Skinner's awesome RegExr.
Menjelajahi Dunia Slot Demo: Dari Mahjong hingga Pragmatic Play!
-
Slot demo telah menjadi fenomena menarik di dunia permainan online,
menawarkan pengalaman bermain yang seru tanpa risiko kehilangan uang.
Dengan berbagai...
7 hours ago