|
-
May 17th, 2005, 05:55 PM
#1
Split (for VB before 6)
Since the Split function was added in VB6, whoever has a previous version of VB can use this 
VB Code:
Private Function Split2(ByVal sString As String, ByVal sSeparator As String) As Variant
Dim sParts() As String
Dim lParts As Long
Dim lPos As Long
lPos = InStr(sString, sSeparator)
While lPos
ReDim Preserve sParts(lParts)
sParts(lParts) = Left(sString, lPos - 1)
sString = Mid(sString, lPos + Len(sSeparator))
lPos = InStr(sString, sSeparator)
lParts = lParts + 1
Wend
If Len(sString) Then
ReDim Preserve sParts(lParts)
sParts(lParts) = sString
lParts = lParts + 1
End If
Split2 = IIf(lParts, sParts, Array())
End Function
Has someone helped you? Then you can Rate their helpful post. 
-
May 18th, 2005, 12:29 PM
#2
Re: Split (for VB before 6)
Great nice code.
Very useful for compatability too, I tried writing something like this for LB once and I failed dismally I may add 
Cheers,
RyaNj
-
May 18th, 2005, 03:13 PM
#3
-
May 18th, 2005, 03:41 PM
#4
Re: Split (for VB before 6)
 Originally Posted by manavo11
Thanks, but I can't take credit for it... I had found it somewhere else on the forum and I dug it up now 
Still not the point, I'm going to see if that is compatible with LB and then there would finally be a split function that works 
Cheers,
RyaNJ
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|