|
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 SortIndexOfSArray(pArray() As String, pString As String, pCompare As VbCompareMethod) As Long
'Function
' Used to determine what index a string will be inserted into an array
' in order for it to be properly sorted.
'Parameters
' pArray (String()) = This is the array we are using to locate an index in.
' pString (String) = This is the string we are finding an index for.
' pCompare (vbCompareMethod) = Determines what type of search will be done.
' Valid Values: vbTextCompare, vbBinaryCompare
'Return (Long)
' Returns the index at which a pString would be inserted into an pArray in order for it
' to be properly sorted.
' If the string is not to be inserted before any of the elements in the array
' (ie. it should be placed at the end), function returns the highest index in the array plus 1.
' Returns 0 if the String is to be inserted at the very top of the array.
' Returns 0 if the specified array (pArray) is empty.
'Entry Conditions
' pCompare must be a valid value (specified above) or the result of this function is undefined
' and it may crash.
'Notes
' This function can handle non-zero-based arrays.
'Version History
' 1.0 7/21/03 Tested
'---
'Initiate variables
Dim C As Long
'Trap: The specified array is empty, return 0 and exit now
If IsEmptyArray(pArray) Then
SortIndexOfSArray = 0
Exit Function
End If
'Loop through each element in pArray to determine where the string should be placed
For C = LBound(pArray) To UBound(pArray)
'The specified string should be inserted before this element, return it's index and exit now
If StrComp(pString, pArray(C), pCompare) = -1 Then
SortIndexOfSArray = C
Exit Function
End If
Next C
'The specified string should not be inserted before any elements in the array
'(it should be appended to the end), return the index of the last element plus 1
SortIndexOfSArray = UBound(pArray) + 1
End Function
|
|
|
|
|