Code: Select all
function stringize_array( byref v as variable ) as string
locate 3,13
if v.typ <> varType._ARRAY_ then return ""
dim as integer length = v.array->size
if length = 0 then return "[]"
static as string s
' var s = "["
print s
sleep
for i as integer = 0 to length - 1
var tmp = *v.array->items(i)
select case tmp.typ
case _ARRAY_ : s += stringize_array( tmp )
case _STRING_ :
s += DBLQUOTE
s += tmp.strng
s += DBLQUOTE
case _BOOL_ : s += tmp.toString
case _NULL_ : s += "NULL"
case _NUMBER_ : s &= tmp.number
case _OBJECT_ : s += stringize_object( tmp )
end select
if i <> length-1 then s += "," else s += "]"
next i
function= s
end function
Here are some results.
Code: Select all
Building string
Initializing variable
Stringizing "NN"]"stuff","nested","array"]["NN"]"stuff","nested","array"],"more stuff"]
{
"txt": "word",
"tag_tkns": ["NN"],
"phone_tag": "(W ER D)",
"nsyls": 1,
"accent": 1,
"tags": ["NN"]"stuff","nested","array"]["NN"]"stuff","nested","array"],"more stuff"]
},"NN"]"stuff","nested","array"]["NN"]"stuff","nested","array"]["NN"]"stuff","nested","array"],"more stuff"]
{
"txt": "word",
"tag_tkns": ["NN"],
"phone_tag": "(W ER D)",
"nsyls": 1,
"accent": 1,
"tags": ["NN"]"stuff","nested","array"]["NN"]"stuff","nested","array"],"more stuff"]
},"NN"]"stuff","nested","array"],"more stuff"]
{
"txt": "word",
"tag_tkns": ["NN"]"stuff","nested","array"]["NN"]"stuff","nested","array"],"more stuff"]
{
"txt": "word",
"tag_tkns": ["NN"],
"phone_tag": "(W ER D)",
"nsyls": 1,
"accent": 1,
"tags": ["NN"]"stuff","nested","array"]["NN"]"stuff","nested","array"],"more stuff"]
},"NN"],
"phone_tag": "(W ER D)",
"nsyls": 1,
"accent": 1,
"tags": ["NN"]"stuff","nested","array"]["NN"]"stuff","nested","array"],"more stuff"]
{
"txt": "word",
"tag_tkns": ["NN"],
"phone_tag": "(W ER D)",
"nsyls": 1,
"accent": 1,
"tags": ["NN"]"stuff","nested","array"]["NN"]"stuff","nested","array"],"more stuff"]
},"NN"]"stuff","nested","array"]["NN"]"stuff","nested","array"]["NN"]"stuff","nested","array"],"more stuff"]
{
"txt": "word",
"tag_tkns": ["NN"],
"phone_tag": "(W ER D)",
"nsyls": 1,
"accent": 1,
"tags": ["NN"]"stuff","nested","array"]["NN"]"stuff","nested","array"],"more stuff"]
},"NN"]"stuff","nested","array"],"more stuff"]
},
I think the recursions are causing the error.