Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove method it doesn't remove the only element of a 1 length array #17

Closed
kennyk4silva opened this issue Aug 28, 2021 · 2 comments
Closed
Assignees
Labels
bug Something isn't working

Comments

@kennyk4silva
Copy link

kennyk4silva commented Aug 28, 2021

Remove method it doesn't remove the only element of a 1 length array
I made a script that stores various string elements in a BetterArray object and then with a For...Next structure if a certain condition is met it removes one specific element of the array with the .Remove(Index) method. The problem is when the BetterArray object remains with 1 element and I want to remove it because the mentioned condition is met again at that point. BetterArray.Remove(0) simply returns the same BetterArray with one element.

To Reproduce
Steps to reproduce the behavior:

  1. Simply run the following Sub procedure:
    Sub BetterArrayTest()
    Dim BA As New BetterArray
    BA.Items = Array("Hello")
    BA.Remove 0
    Debug.Print BA.ToString
    End Sub

  2. See the result in the Inmediate Window (see screenshot). It doesn't remove the "Hello" element.

Expected behavior
If a BetterArray object has one element (Lenght = 1), then the syntax BetterArray.Remove(0) really remove that element.

Screenshots
image

Operating System:

  • Windows 7 64 bits

Host Application:

  • MS Excel

Additional context
The problem is only when the BetterArray object has one element. If it has more than one element the .Remove(0) method effectively removes the first element of the array.

@kennyk4silva kennyk4silva added the bug Something isn't working label Aug 28, 2021
@kennyk4silva kennyk4silva changed the title [BUG] [BUG] Remove method it doesn't remove the only element of a 1 length array Aug 28, 2021
@kennyk4silva kennyk4silva changed the title [BUG] Remove method it doesn't remove the only element of a 1 length array Remove method it doesn't remove the only element of a 1 length array Aug 28, 2021
@Senipah
Copy link
Owner

Senipah commented Aug 29, 2021

Hi @kennyk4silva,

Thank you so much for letting me know about this! Issue should now be fixed and is available in the latest release (v1.7.6)

Thanks for using BetterArray and please let me know if you have any other issues.

@kennyk4silva
Copy link
Author

Hi @Senipah, thank you so much for your great effort making that excellent class. I'm using it a lot processing txt files and arrays in a fast and effective way. I will let you know if I found another issue. Greetings from Venezuela.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants