redconservatory
redconservatory

Reputation: 21934

convert instance variable to String?

Is there a simple way to convert an instance variable to a String?

Upvotes: 0

Views: 1367

Answers (2)

Daniel
Daniel

Reputation: 35714

for string I always use myStringVar = myInstance + "";

Upvotes: 0

Sam Dolan
Sam Dolan

Reputation: 32532

Use this (a bit safer because it will still work if myInstanceVariable is null):

String(myInstanceVariable)

or

myInstanceVariable.toString()

Also, I just found this nice article explaining the different methods: http://www.morearty.com/blog/2008/07/28/actionscripts-different-ways-to-convert-an-object-to-a-string/

Upvotes: 5

Related Questions