PDA

View Full Version : astring - astore



strato
2020-11-05, 19:51
is there any way to prevent type changing while using astring() - astore()?

declare a[2]
a[1] = "a"
a[2] = 2.0
?type("a[2]") // N
x = astring(a,",")
=astore(aa,x,",")
?type("aa[2]") // C

barrymavin
2020-11-05, 22:22
No it treats all items in the comma separated list as character strings.


for I=1 to alen(a)
if isdigit(a[i])
a[i] = val(a[i])
endif
endfor

You may want to look at json_encode() / json_decode() and metadata_encode() / metadata_decode() also.