Searches for the location of a specific string in a sorted clsD3DynamicArray.
bValue = object.brLocateStrSeq( sFind, sSeq, nFound, [ vnAMC], [ vnVMC], [ vnStart])
Parameter | Description |
---|---|
bValue | The return value is a Boolean data type that is True if sFind is found in object. |
object | An object variable that represents a clsD3DynamicArray object that is sorted. |
sFind | A String that specifies the element to be found. |
sSeq | A String specifying the sorting sequence of object, as shown in Settings (see below). |
nFound | A Long indicating the position where sFind was found. If not found, this variable defaults to the end of the dynamic array. This is an output-only parameter. |
vnAMC | Optional. A Variant (Integer subtype) specifying the attribute to be searched. |
vnVMC | Optional. A Variant (Integer subtype) specifying the value to be searched. |
vnStart | Optional. A Variant (Integer subtype) specifying the first field from which to begin the search. |
Use the following strings to describe the sorting sequence of the clsD3Dynamic Array object used as the source..
Sorting Sequence Parameters | Description |
---|---|
al | Ascending, Left-justified |
ar | Ascending, Right-justified |
dl | Descending, Left-justified |
dr | Descending, Right-justified |
This method has the same functionality as brLocateSeq. The difference between the two methods is the way the element to be located and the sorting sequence are passed. In the brLocateStrSeq method, both the element to be located and the sorting sequence are passed as strings (sFind and sSeq). In the brLocateSeq method, these parameters are passed as clsD3DynamicArray objects.
Sub Main() Dim oEnv As New clsD3Environment Dim oConn As clsD3Connection Dim oArray As New clsD3DynamicArray Dim sContinent As String Dim lFound As Long Set oConn = oEnv.brOpenConnection("ODBC", "production") oArray.brCString = "Europe" & D3VMChr & "South America" & D3VMChr & "Africa" Set oArray = oConn.brSort(oArray) sContinent = InputBox("Enter a continent") If oArray.brLocateStrSeq(sContinent, "al", lFound, 1) = True Then MsgBox sContinent & " is already there." Else oArray.brInsertStr sContinent, 1, lFound End If MsgBox oArray.brCString oEnv.brCloseConnection oConn Set oArray = Nothing Set oEnv = Nothing End Sub
locate