I think that this can be very good container...
Class AssociativeArray
'=====================
bstring s,c1,c2,c3
sys max
'
method find(string k) as sys
sys i=instr(s, c1+k+c2)
if i>max then i=0
return i
end method
'
method dat(string k) as string
'GET
sys i=find k
if i then
i=instr i,s,c2
sys j=instr(i,s,c3)
if j then return mid s,i+1,j-i-1
end if
end method
'
method dat(string k, d) as sys
'PUT
sys i
if max=0 then
'SET FIELD MARKERS
c1=chr(1) : c2=chr(2) : c3=chr(3)
else
i=find k
end if
if i=0 then
'APPEND
sys m=max+len(k)+len(d)+3
if m>len s then
s+=nuls 0x1000+m-max 'stretch at least 4k
end if
mid s,max+1,c1+k+c2+d+c3
i=max
max=m
else
'REPLACE
i+=len(k)+2
sys j=instr(i,s,c3)
if j then
'INSERT DATA
s=left(s,i-1)+d+c3+mid(s,j+1)
max=len s
end if
end if
return i
end method
method clear()
s="" : c1="" : c2="" : c3="" : max=0
end method
method fill(sys n,...)
sys i
indexbase 0
bstring w at @param
n+=n
for i=1 to n step 2
dat w(i),w(i+1)
next
end method
end class
'====
'TEST
'====
AssociativeArray A
'fill key-value pair
A.fill 1,"shoes","LC1"
A.fill 1,"ships","LC2"
A.fill 1,"sealingwax","LC3"
A.fill 1,"cabbages","LC4"
A.fill 1,"kings","LC5"
'print A.s
print A.dat("ships") 'result LC2
A.dat("computers")="LC99" '
print A.dat("computers") 'result LC99
A.clear()
'new
AssociativeArray arr01
arr01.fill 1,"a","10"
arr01.fill 1,"b","20"
arr01.fill 1,"c","10"
print arr01.dat("b") ' res 20
arr01.dat("d") = "40"
print arr01.dat("d") 'res 40