Converting Array and String
Hello, everyone.
I'm given an Array, it is not in format {abc:1, qwe:'ghj'}. The array looks like this:
new Array(["SMTH", 1, 2, 3], ["ANTH", 0, 0, 0, [4, 5, 6]], ["ZZZ", 8])
As you can see, it has only square brackets, and even in other square brackets.
The task is:
1) Convert this Array to String, because server only saves strings. Save it.
2) Load saved String and convert it to Array.
So, a usual task for the game.
Please, tell me, in what Language they may be converted, what should I do.
1) I've tried to convert (1) Array to String, so that square brackets remain, even in another [], but AS3 removes them. Well, I wrote my own function. Now the result (1) looks exactly like you saw above in bold letters.
2) But another problem exists: how to convert that string to Array back...
Array.match() says there is no array, seems like it doesn't notice square brackets at all.
I've tried split, IndexOf and others, but got stuck in those [[]]
Simple myString as Array also doesn't work.
I suppose, I'm doing it all wrong. So i've tried converting Array to JSON. It turned out to be too much odd symbols, it was saved, but i have an limitation of symbols count, so JSON is not the answer.
