Results 1 to 4 of 4

Thread: Very fast string parser for Access VBA

  1. #1

    Thread Starter
    Addicted Member djengiz's Avatar
    Join Date
    Jan 2001
    Location
    The Netherlands
    Posts
    153

    Very fast string parser for Access VBA

    Does anyone have a fast string parser for Access VBA

  2. #2
    Hyperactive Member
    Join Date
    Jul 2000
    Location
    Halifax,UK
    Posts
    274
    dpends what your parsing for, and what your strings like and how long it is
    VB6 VS2005

  3. #3
    jim mcnamara
    Guest
    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

  4. #4

    Thread Starter
    Addicted Member djengiz's Avatar
    Join Date
    Jan 2001
    Location
    The Netherlands
    Posts
    153
    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
  •  



Click Here to Expand Forum to Full Width