|
-
Feb 27th, 2004, 11:17 AM
#1
Thread Starter
Addicted Member
VBScript Array Push
Code:
Function Push(ByRef mArray, ByVal mValue)
Dim mValEl
If IsArray(mArray) Then
If IsArray(mValue) Then
For Each mValEl In mValue
Redim Preserve mArray(UBound(mArray) + 1)
mArray(UBound(mArray)) = mValEl
Next
Else
Redim Preserve mArray(UBound(mArray) + 1)
mArray(UBound(mArray)) = mValue
End If
Else
If IsArray(mValue) Then
mArray = mValue
Else
mArray = Array(mValue)
End If
End If
Push = UBound(mArray)
End Function
It is something I cooked up for my ASP application. I got sick of working around not having a push. It will push a single value onto an array, or push an array of values. I haven't hardened it, yet, but let me know what you think.
Travis, Kung Foo Journeyman
Web Standards: HTML 4.01, CSS Level 2, ECMA 262 Bindings to DOM Level 1, JavaScript 1.5 Guide and Reference
Perl: Documentation, Learn Perl, Llama, Camel, Cookbook, Perl Monks, Perl Mongers, O'Reilly's Perl.com, ActiveState, CPAN, TPJ, and use Perl;
OSS: Mozilla, MySQL (Manual)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|