|
1 members (Russ),
10,950
guests, and
1,516
robots. |
|
Key:
Admin,
Global Mod,
Mod
|
|
|
S |
M |
T |
W |
T |
F |
S |
|
|
|
1
|
2
|
3
|
4
|
5
|
|
6
|
7
|
8
|
9
|
10
|
11
|
12
|
|
13
|
14
|
15
|
16
|
17
|
18
|
19
|
|
20
|
21
|
22
|
23
|
24
|
25
|
26
|
|
27
|
28
|
29
|
30
|
31
|
|
|
|
|
This is another custom island. This one could be used for ads. This spot is one of the best places for ads on your site to be placed. This can be enabled/disabled on a per forum basis.
|
|
|
|
Joined: Dec 1999
Posts: 30,868
Master Elite Member
|
Public Function ShiftSArray(pArray() As String, pStartIndex As Long, pEndIndex As Long, pShiftCount As Long) As String()
'Function
' Used to shift all elements down 1 space in an array.
'Parameters
' pArray (String()) = The array to be shifted.
' pStartIndex (Long) = The index to begin shifting.
' pEndIndex (Long) = The index to stop shifting.
' pShiftCount (Long) = The number of elements to shift.
'Return (String())
' Returns the specified array with all elements shifted.
' Only elements between pStartIndex and pEndIndex are shifted.
' Elements are shifted pShiftCount elements up or down, depending on whether
' pShiftCount is positive or negative.
' If pShiftCount is positive, elements are shifted to higher-numbered positions.
' If pShiftCount is negative, elements are shifted to lower-numbered positions.
' If pShiftCount is zero, functions returns the specified array (pArray) unchanged.
' If pArray is empty, function always returns an empty String array.
'Entry Conditions
' The specified array must already contain enough elements to perform the shift
' or this function will crash. Even if shifting elements in a negative direction,
' if you attempt to move any of the shifted elements outside the array,
' the function will crash.
' If pStartIndex is greater than pEndIndex, the function will return pArray unchanged.
' If pStartIndex is equal to pEndIndex, then only 1 element will be shifted.
' If pStartIndex or pEndIndex are outside the bounds of the array, the function will crash.
'Notes
' This function works with non-zero-based arrays.
'Version History
' 1.0 7/5/2003 Tested
'---
'Initiate Variables
Dim C As Long 'counter
Dim R() As String 'return buffer
'Preload the return buffer
R = pArray
'Our specified shift count is positive, loop backward
If pShiftCount > 0 Then
'Loop though all the elements to be shifted, backwards
For C = pEndIndex To pStartIndex Step -1
R(C + pShiftCount) = R(C)
Next C
'Our specified shift count is negative, loop forward
ElseIf pShiftCount < 0 Then
'Loop though all the elements to be shifted
For C = pStartIndex To pEndIndex
R(C + pShiftCount) = R(C)
Next C
End If
'Return the result
ShiftSArray = R
End Function
|
|
|
|
|