VBScript Array

Pretty neat script I wrote that allowing preserving an array by cloning it.

Function AddToArray(ArrayToClone, ValueToAdd)
Dim a, tempArray
    On Error Resume Next
    ReDim tempArray(UBound(ArrayToClone) + 1)
    If Err.Number = 0 Then
        For a = LBound(ArrayToClone) To UBound(ArrayToClone)
            tempArray(a) = ArrayToClone(a)       
        Next
    ElseIf Err.Number = 13 Then       
        Err.Clear
        ReDim tempArray(0)
    Else
        WScript.Echo Err.Number
    End If
    tempArray(UBound(tempArray)) = ValueToAdd       
    AddToArray = tempArray
End Function

Technorati Tags: ,
20. July 2009 11:02 by Danny Gershman | Comments (0) | Permalink

Add comment


(Will show your Gravatar icon)  

  Country flag


Enter Numbers In Image Above: biuquote
  • Comment
  • Preview
Loading



About dannyg

dannyg has been writing software for the last 12+ years and worked with various languages and programs.  He specializes business process automation, versatile solutions and R&D.