Hello all. The dictionary object can be used to transform a string into name value pairs however this is only going to work on a two dimensional structure. What option is there to do this with a string that is more than two dimensions?
Here is how I am using it currently:
Code:
'my example string is |#| delimited
assessStr = "aid=|#|objCatID=1|#|pid=18296|#|status=5|#|cid=12109|#|theDate=20140929145929"
set assess = Server.CreateObject("Scripting.Dictionary")
myArray = split(assessStr, newDelimiter1)
dim key,val,rec
for i = 0 to uBound(myArray)
key = mid(myArray(i),1, instr(myArray(i), "=")-1 )
val = replace(myArray(i), (key&"="), "")
assess.add key,val
next
set myArray = nothing
'now can use these as name value pairs like so
response.write assess("aid") & "<BR>" & assess("objCatID") & "<BR>" & assess("pid") & "<BR>" & assess("status") & "<BR>" & response.write assess("cid") & "<BR>" & response.write assess("theDate") & "<BR>"
Also second question. If I have a string that has two delimiters (|#| and ~#~ ) such as:
objStr = "objID=1|#|status=1|#|or=A|#|mr=A|#|oc=someOwnComm ent|#|mc=someManagerComment~#~objID=2|#|status=1|# |or=D|#|mr=D|#|oc=someOwnComment|#|mc=someManagerC omment~#~objID=3|#|status=1|#|or=C|#|mr=C|#|oc=som eOwnComment|#|mc=someManagerComment"
To make all of these name value pairs available as per above, would using two nested dictionary objects the most efficient method