Announcement

Collapse
No announcement yet.

PARSE$ Wish

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • PARSE$ Wish

    I am working on a program which reads and converts various types of files
    including packed files (with ZLIB). I used PARSECOUNT and PARSE$ to
    read the unpacked buffer (for those of you unfamilliar with ZLIB, it
    unpaks .zip files into a buffer in memory). This worked ok until I
    came across some very large files which were painfully slow.

    I reworked my parse loop until it was as tight as can be until it hit
    me (DOH!) the PARSE$ must be counting from 1 to [x] every time I
    request a specific record, and since these files were exceeding 15,000
    records, this loop got longer and longer.

    I solved my problem by using INSTR and parsing the file myself.

    Now for my wish:

    I wish I could parse a string into a string array:

    DIM Buffer AS STRING
    DIM File() AS STRING
    DIM FileSize AS LONG
    DIM crlf AS STRING

    crlf=CHR$(13,10)

    FileSize=PARSECOUNT(Buffer,crlf)
    REDIM File(FileSize)

    PARSE Buffer,crlf INTO FILE()

    This would allow PARSE to be FAST, and we all like FAST.




    ------------------
    Thanks,

    John Kovacich
    Thanks,

    John Kovacich
    Ivory Tower Software

  • #2
    That would certainly by fast to write, and perhaps some efficiencies could make it fast to execute.

    But you could certainly write such a function using INSTR (sounds like you've aready done that) or with REGEXPR.

    MCM
    Michael Mattias
    Tal Systems Inc. (retired)
    Racine WI USA
    [email protected]
    http://www.talsystems.com

    Comment

    Working...
    X