View Full Version : URLRequest " or ' marks
Hi
Quick question:
should i use
URLRequest("http://domain.com")
or
URLRequest('http://domain.com')
" marks
or
' marks
THe funny thing is that both work but what's the difference?
Thanx
evride
09-27-2009, 05:09 AM
nothing. with url's they won't matter much at all, but it's with other strings where you'll see it's use. like this
var str:String = 'John said, "Dude, AS3 is fun."';
or
var str :String = "It's gonna rain today.";
Just use one over the other when you have to slash out more of the ' or ". It's not like PHP where the " let's you insert variables within the string.
wvxvw
09-27-2009, 08:04 AM
It's recommended that you use double quotes, since in many other languages single quotes mean char data type (i.e. 8 bits of data, or, 8-16 bits if the language uses UTF-8 natively). char is also a reserved keyword in AS3, so, you never know, maybe one day we'll see that data type in AS too.
cjx3711
09-27-2009, 08:06 AM
I think that it's also worth mentioning that if you need both " and ' in one string, you can use the \ to work it.
For example if your string needs to be:
I said, "He's a good programmer."
The code would be
var str:String = "I said, \"He's a good programmer.\"";
henke37
09-27-2009, 09:56 AM
Actually, utf-8 can be longer than 2 bytes, i think the maximum length was something like 5 bytes.
wvxvw
09-27-2009, 10:50 AM
Actually, utf-8 can be longer than 2 bytes, i think the maximum length was something like 5 bytes.
Ah, yes, good point, wiki says it can be up to 4 octets.
|
vBulletin® v3.8.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.