"more than one word"
then the program will split up the 4 words and put them into separate
variables. ie.
word1, word2, word3 etc
I dont have vb 6 so cant take advantage of the Split function. Or can I
create the same function in vb 5?
Any help wil be appreciated
John Watson
Public Sub split(Seperator As String, ByVal target As String, Results() As
String)
Dim iT, iTa As Integer
iT = 1
iTa = 0
Do
iT = InStr(target, Seperator)
If iT <> 0 Then
ReDim Preserve Results(iTa) As String
Results(iTa) = Left$(target, iT - 1)
target = Mid$(target, iT + 1)
Inc iTa
End If
Loop Until iT = 0
If Len(target) <> 0 Then
ReDim Preserve Results(iTa) As String
Results(iTa) = target
End If
End Sub
John Watson wrote in message <36b5f...@newsread3.dircon.co.uk>...
ReDim TheResult(MIN_SIZE) As Variant
Count = 0
DelimiterPos = InStr(TheString, Delimiter)
If DelimiterPos Then
Do
If Count > MIN_SIZE Then ReDim Preserve TheResult(Count) As
Variant
TheResult(Count) = Left$(TheString, DelimiterPos - 1)
TheString = Mid$(TheString, DelimiterPos + Len(Delimiter))
DelimiterPos = InStr(TheString, Delimiter)
Count = Count + 1
Loop While DelimiterPos > 0
ReDim Preserve TheResult(Count) As Variant
TheResult(Count) = TheString
Else
ReDim TheResult(Count) As Variant
TheResult(Count) = TheString
End If
Split = TheResult
End Function
--
Karl Westberg, MCP