|
Post by bluatigro on Feb 23, 2021 14:56:15 GMT
this is a try at a dinamic array it wil have 50 dimensions
error : my al.get2() does not work right
it is a writeonce readmany times array
a$=al.add$(a$,"1",0)
print a$
a$=al.add$(a$,"2",0)
print a$
b$=al.add$(b$,"3",0)
print b$
b$=al.add$(b$,"4",0)
print b$
c$=al.add$(c$,a$,1)
print c$
c$=al.add$(c$,b$,1)
print c$
d$=al.get$(c$,2,1)
print d$
e$=al.get$(d$,1,0)
print e$
f$=al.get2$(d$,"1,1,")
print f$
f$=al.get2$(d$,"1,2,")
print f$
f$=al.get2$(d$,"2,1,")
print f$
f$=al.get2$(d$,"2,2,")
print f$
end
function al.slice$( al$ , start , eind , c )
uit$ = ""
for i = start to eind
uit$ = al.add$( uit$ _
, word$( al$ , i , cut$(c) ) , c )
next i
end function
function al.add$( al$ , item$ , c )
al.add$ = item$ + cut$(c) + al$
end function
function al.isthere( al$ , item$ , c )
al.isthere = instr( cut$(c) + al$ _
, cut$(c) + item$ + cut$(c) )
end function
function al.get$( al$ , no , c )
al.get$ = word$( al$ , no , cut$(c) )
end function
function al.get2$( al$ , no$ )
i = 1
uit$=al$
while word$(no$,i,",")<>""
uit$=al.get$(uit$,val(word$(no$,i,",")),i-1)
i=i+1
wend
al.get2$=uit$
end function
function cut$( dimension )
if dimension < 0 or dimension > 50 then
uit$ = " "
else
uit$ = chr$( 255 - dimension )
end if
cut$ = uit$
end function
|
|
|
Post by tsh73 on Feb 24, 2021 8:29:35 GMT
Hello Bluatigro For al.get2() you need start with higher delimiter and get down One of ways shown below
function al.get2$( al$ , no$ ) 'PRINT al$;"->";no$ dimension = 0 for i = 1 to 50 if instr(al$, chr$( 255 - i )) = 0 then exit for next dimension = i-1 i = 1 uit$=al$ 'print space$(i*2);">";uit$ while word$(no$,i,",")<>"" delim=dimension+1-i 'dounwards uit$=al.get$(uit$,val(word$(no$,i,",")),delim) i=i+1 'print space$(i*2);">";uit$ wend al.get2$=uit$ end function
|
|
|
Post by bluatigro on Feb 27, 2021 10:36:53 GMT
try 2
error : get2() stil wrong
a$=al.add$(a$,"1",1) print a$ a$=al.add$(a$,"2",1) print a$ b$=al.add$(b$,"3",1) print b$ b$=al.add$(b$,"4",1) print b$ c$=al.add$(c$,a$,2) print c$ c$=al.add$(c$,b$,2) print c$ d$=al.get$(c$,2,2) print d$ e$=al.get$(d$,1,1) print e$ f$=al.get2$(d$,"1,1",2) print f$ f$=al.get2$(d$,"1,2",2) print f$ f$=al.get2$(d$,"2,1",2) print f$ f$=al.get2$(d$,"2,2",2) print f$ end function al.slice$( al$ , start , eind , c ) uit$ = "" for i = start to eind uit$ = al.add$( uit$ _ , word$( al$ , i , cut$(c) ) , c ) next i end function function al.add$( al$ , item$ , c ) al.add$ = al$ + item$ + cut$(c) end function function al.isthere( al$ , item$ , c ) al.isthere = instr( cut$(c) + al$ _ , cut$(c) + item$ + cut$(c) ) end function function al.get$( al$ , no , c ) al.get$ = word$( al$ , no , cut$(c) ) end function function al.get2$( al$ , no$ , dimmax ) uit$=al$ for i = dimmax to 1 step -1 uit$=al.get$(uit$,val(word$(no$,i,",")),i) next i al.get2$=uit$ end function function cut$( dimension ) if dimension < 0 or dimension > 50 then uit$ = " " else uit$ = chr$( 255 - dimension ) end if cut$ = uit$ end function
|
|