|
-
Aug 3rd, 2000, 01:49 PM
#1
Thread Starter
Monday Morning Lunatic
Does anyone with VB6 have the exact syntax of the Split() function? I'm getting a bit pi**ed off with VB5's lack, so I thought I'd have a go at hacking my copy of VB and adding some stuff into it. I've already written a replacement (back in the days of VB4), and thought I'd put it in.
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Aug 3rd, 2000, 02:01 PM
#2
Code:
Split(ByVal sIn As String, Optional sDelim As String, Optional nLimit As Long = -1, Optional bCompare As VbCompareMethod = vbBinaryCompare) As Variant
-
Aug 3rd, 2000, 02:12 PM
#3
transcendental analytic
The whole thing
Code:
Public Function Split(ByVal sIn As String, Optional sDelim As String, Optional nLimit As Long = -1, Optional bCompare As VbCompareMethod = vbBinaryCompare) As Variant
Dim sRead As String, sOut() As String, nC As Integer
If sDelim = "" Then
Split = sIn
End If
sRead = ReadUntil(sIn, sDelim, bCompare)
Do
ReDim Preserve sOut(nC)
sOut(nC) = sRead
nC = nC + 1
If nLimit <> -1 And nC >= nLimit Then Exit Do
sRead = ReadUntil(sIn, sDelim)
Loop While sRead <> ""
ReDim Preserve sOut(nC)
sOut(nC) = sIn
Split = sOut
End Function
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Aug 3rd, 2000, 02:21 PM
#4
Thread Starter
Monday Morning Lunatic
Thanks, both of you. Kedaman - thanks for the code, but I already have one! (although I may dissect it in the traditional way...)
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Aug 3rd, 2000, 03:03 PM
#5
Kedaman, you code requires another function called ReadUntil otherwise you'll get an error.
Code:
Public Function ReadUntil(ByRef sIn As String, sDelim As String, Optional bCompare As VbCompareMethod = vbBinaryCompare) As String
Dim nPos As String
nPos = InStr(1, sIn, sDelim, bCompare)
If nPos > 0 Then
ReadUntil = Left(sIn, nPos - 1)
sIn = Mid(sIn, nPos + Len(sDelim))
End If
End Function
-
Aug 3rd, 2000, 04:17 PM
#6
transcendental analytic
Ok ok, i'm sure there are better Split functions, posted somewhere, or parksie could show us something
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Aug 3rd, 2000, 06:46 PM
#7
Fanatic Member
Again!
I can't seem to help myself. Everytime i see the word Split() i must post a reply.
Fast Split
Iain, thats with an i by the way!
-
Aug 3rd, 2000, 07:09 PM
#8
transcendental analytic
That's the one i was talking about
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
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
|