我正在做这个项目,我需要将完整的字符数组保存到字符串中。我希望字符串中包含[]
个字符。
Example:
aArray = [
[0,0,0,0],
[0,0,0,0],
[0,0,0,0],
[0,0,0,0]
];
myString = aArray.toString();
trace(myString);
在我的输出中,我得到:
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0...
我想要[]
括号。
答案 0 :(得分:1)
var aArray:Array = [
[0,0,0,0],
[0,0,0,0],
[0,0,0,0],
[0,0,0,0]
];
var string:String = JSON.encode(aArray);
trace(string);
输出:
"[[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0]]"