Python's repr
function is awesome: it returns a printable representation of an object.
For example, repr(["a'b", {1: 2}, u"foo"])
is the string '["a\'b", {1: 2}, u\'foo\']'
. Notice, eg, how quotes are properly escaped.
So, is there anything like this for ActionScript?
For example, right now: [1, 2, ["3", "4"]].toString()
produces the string "1,2,3,4"
… Which really isn't very helpful. I'd like it to produce a string like… Well, '[1, 2, ["3", "4"]]'
.
I have considered using a JSON library… But that's less than ideal, because it will try to serialize instances of arbitrary objects, which I don't really want.