Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
vb script for reverse of an array?
#1
How to write a vb script for reverse of an array(reversing an array)?
Reply
#2
below is the snippet which will give you the basic idea.
Code:
a = Array("a","b","c") i = 0 For x = ubound(a) to 0 Step-1 ReDim preserve b(i) b(i) = a(x) i= i+1 Next msgbox "your array items" & join(a) msgbox "Reservese items" &join(b)
did not following the coding standards... it's a raw code.
Thanks,
SUpputuri
Reply
#3
Hi,

Here is one more method:

Code:
Sub Reverse( ByRef myArray ) Dim i, ArrCount , HalfArrCount , strHolder ArrCount = UBound(a) HalfArrCount = Int(ArrCount/2) For i = 0 to HalfArrCount Step 1 strHolder= a(i) a(i) = a(ArrCount-1) a(ArrCount-1) = strHolder Next End Sub

Try this...
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  How to convert a single dimension array to two dimensional array venkatesh9032 3 6,428 02-10-2014, 03:07 PM
Last Post: pranikgarg
  Adding array to another Global array in VB Script test911 1 3,577 12-02-2012, 12:40 PM
Last Post: parminderdhiman84

Forum Jump:


Users browsing this thread: 1 Guest(s)