[thelist] RE: Comparing Arrays in ASP

Peter Brunone (EasyListBox.com) peter at easylistbox.com
Thu Aug 26 20:44:32 CDT 2004


   Thanks for that explanation; I was really starting wonder if this was some weird analogy you picked up from your MASH days in 'Nam...

   BTW, sorry about the flood of identical replies; I'm out of town (web-based email) and this computer is a little less than friendly.  And just so this is somewhat relevant...

<tip type="VBScript Arrays" commonregion="ASP" author="Peter Brunone">
   If you have a scenario where your data has multiple parent/child levels and each parent could have a whole bunch of children, you can use what I like to call "multi-degree arrays".  This takes advantage of the fact that all variables in VBScript are of type variant... so they can switch types at need.

   Say you have an array of delimited strings.  You can perform a Split operation on each of those strings, so you now have an array of arrays.  If each of the resulting array members is delimited with a *different" string, you can split those in turn and have an array of arrays of arrays... and so on.  This can be done in reverse as well, by joining the child-most arrays into one string, so you have an array of arrays, and joining again to have just one array of double-delimited strings.

   For example:
' Start with multi-delimited string
myData = "asdf|asdf|asdf||asdf|asdf|asdf"

' Split the original string into an array
myData = Split(myData, "||")

For i = 0 To UBound(myData)
   myData(i) = Split(myData(i), "|")
   For j = 0 To UBound(myData(i))
      myData(i) = Split(myData(i), "sd")
   Next
Next

' So now, myData(0)(0) = "a"

   You can do the same thing in reverse, to roll up the arrays into one master string.

   I know this sounds crazy, and I don't blame you if you didn't follow it -- or just plain hate the idea -- but it saved my hide on an ASP project at GTE years ago.
</tip>

Cheers,

Peter Brunone
___________________
www.EasyListbox.com


Original Message:
>From: Rob Smith <rob.smith at THERMON.com>

>> apply the tracheotomy axiom:
>
>Stupid spell checker.... supposed to be trichotomy (a numerical state is
>either <, =, or >)
>
><tip type="Spell Checking" author="Rob.Smith">
>	Double check the speck checker. You'll never know when you have to
>perform surgery.
></tip>
>-- 




More information about the thelist mailing list