|
-
Dec 19th, 2001, 07:29 AM
#1
Thread Starter
Addicted Member
Very fast string parser for Access VBA
Does anyone have a fast string parser for Access VBA
-
Dec 19th, 2001, 07:39 AM
#2
Hyperactive Member
dpends what your parsing for, and what your strings like and how long it is
-
Dec 19th, 2001, 07:40 AM
#3
For VBA & VB5 that don't have a Split function - this breaks a long string into fields (array elements) based on a separator character like space or | (pipe) or whatever
From Aaron Young
Code:
Private Function Split2(ByVal sString As String, ByVal sSeparator As String) As Variant
'Written by Aaron Young
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
End If
Split2 = IIf(lParts, sParts, Array())
End Function
-
Dec 19th, 2001, 08:50 AM
#4
Thread Starter
Addicted Member
Hi all,
Thankyou for replying. The problem is as follows:
If have a text file (about 800k) and its full of text. The text has field delimiters (<~>) and recorddelimiters (<---NEXT--->) dont ask me why they are chosen as they are......Every record has 34 fields.
I need to parse the textfile twice: First get all recorddelimiters and then parse the string using the fieldelimters. Then all the seperate tokes need to be inserted with a recordset.
Any ideas?
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
|