Actionscript 3.0 — String

Here I am talking about some tricky things about “String” class in actionscript 3.0:

We all know about the the operator like “+”, “+=” “<” “<=” “>” and “>=”. How actually they work in actionsript? I will give several examples;

when “+” and “+=” are used as string operator, they will treat their object as “Sting”, no matter what originally they are.

var a:String=”ss”;

var b:int=3;

var c:String=a+b;

trace(c) ;//—-ss3

var d:Boolean=true;

c+=d;

trace(c)//—-ss3true;

here you can see, all the variables before and after “+” or “+=” are treated as “string”

The difference between “substring()”,”slice()” and “substr()”;
Continue reading