I wrote a little piece of code to rotate array elements.
The problem is of course, how to pass ANY type of array.
My array's are useally types.
This is the code i would like to use: (doesn't work of course)
The problem is of course, how to pass ANY type of array.
My array's are useally types.
This is the code i would like to use: (doesn't work of course)
Code:
Function ArrayRotate( ArrayToRot() As ANY, ElementToRot As Long ) As Long Dim a As Long Dim T As String a = Ubound( ArrayToRot ) If a < 0 Then Exit Function T = String$( Len( ArrayToRot( a ) ), Chr$( 0 ) POKE$ StrPtr( T ), PEEK$ VarPtr( ArrayToRot( ElementToRot ) ), Len ( T ) ARRAY DELETE ArrayToRot(), ElementToRot ReDim Preserve ArrayToRot( LBound( ArrayToRot ) To a ) POKE$ VarPtr( ArrayToRot( a ) ), PEEK$ StrPtr( T ), Len ( T ) End Function
Comment