Results 1 to 2 of 2
  1. #1
    Join Date
    Dec 2002
    Location
    Préverenges, Switzerland
    Posts
    3,740

    Unanswered: clear array (including nulling UBound/LBound)

    i have a procedure level declaration of an array which is used to hold the results of a split().

    it is a critical part of my source-file validation that the code makes zero assumptions about the number of elements in the array (this part of the validation is precisely about checking the number of fields in the source data)

    the array is reused by a loop for each available source file.

    so the question: how to return a previously declared array to the initial virgin state that was generated by
    dim myArray() as string
    after the first split() has populated it with 32 elements?

    i do NOT want to move the array declaration out of the looping procedure.

    izy
    currently using SS 2008R2

  2. #2
    Join Date
    Dec 2002
    Location
    Préverenges, Switzerland
    Posts
    3,740
    FIXED
    stupid error - i forgot to clear the buffer that was being split so successive loops had 32, 64, 96 etc elements.

    split seems to zero-ize the array all on its own without the need for explicit intervention.

    izy
    currently using SS 2008R2

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •