More UVobjects Stuff

Called the awkward UniVerse subroutine PICK.LOCATE for a while, have now come up with this:

Finally, a version of the LOCATE statement (yes, it is a statement in Multi-Value, not a function -- about the only statement with arguments)


Attribute VB_Name = "modVBlocate"
Option Explicit

Public Sub subVBlocate(target As String, Source As String, character As Long, pos As Long, found As Long)
' target = string to locate
' source should be a pick dynamic array delimited with "character"'
' character = ascii # for delimiter, e.g. 253
' pos returns value target was found in or next available value if not found
' found, 0 = target not found in source, 1 = was found in target
'
' ray 06/2003:

Dim splitline, k
'
' try to locate within delimiters a la pick:
splitline = Split(Source, Chr$(character))
pos = 0
found = 0
For Each k In splitline
   pos = pos + 1
   If k = target Then
      found = 1
      Exit For ' done
   End If
Next
If found = 0 Then pos = pos + 1 ' where it should go
End Sub

07/20/2003 20:48:20 Eastern Daylight Time


*

Contact us at: raykelly@rakelly.com

Back

* Express