Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8018397
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T21:07:09+00:00 2026-06-04T21:07:09+00:00

I have a large one dimensional array that is called ArrayHold which is populated

  • 0

I have a large one dimensional array that is called ArrayHold which is populated at runtime. I run a loop to scan through the array to find out which elements need to be removed based on a few parameters. This all works great, now I am left with two arrays. The original one and a new one which contains the locations of the elements to be removed.

Original Array:

("A")("B")("C")("D")("E")("F")("G")("H")

Second Array with index/count of elements that needs to be removed:

("0")("3")("5")("7")

End result should be preferably not in a new array but a “ReDim” of the original array:

("B")("C")("E")("G")

What would be the simplest way to achieve this? I could run a loop to make all the elements that need to be removed "0" or ""? Would there be an easy way of resizing and array by dropping/removing all the white space or empty elements?

Thanks so much in advance.. 🙂

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T21:07:10+00:00Added an answer on June 4, 2026 at 9:07 pm

    I would suggest to use LINQ for this, your code becomes more readable and maintanable then.

    Since you haven’t shown how you’ve filtered the first array, i assume for the example that you want to remove all “A”,”D”,”F”,”H” (case sensitive):

    Dim original = {"A", "B", "C", "D", "E", "F", "G", "H"}
        ' remove A,D,F,H
    Dim result = (From str In original
                  Where Not {"A", "D", "F", "H"}.Contains(str)).ToArray()
    

    Result:

        (0) "B" String
        (1) "C" String
        (2) "E" String
        (3) "G" String
    

    End result should be preferably not in a new array but a “ReDim” of
    the original array: (“B”)(“C”)(“E”)(“G”)

    Of course above creates a new array, but Redim creates also a new array.

    Edit: Here’s an example which removes elements based on the index, assuming you have an int[] with all indices that you want to delete from the first array:

    Dim deleteIndices = {0, 3, 5, 7}
    ' remove elements with index 0,3,5,7
    Dim result = original.
              Where(Function(str, index) Not deleteIndices.Contains(index)).
              ToArray()
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a program which needs to turn many large one-dimensional numpy arrays of
i have a large mysql database table in which one column contains values ranging
I have a large-ish project that contains one class that reads from a file
I have an array of documents, where each document have another simple one-dimensional array
I'm working on a large codebase that doesn't have quotes around any array keys,
We have a large-ish query here that has several params, and for each one,
Okay, I have a multi-dimensional array which is statically-allocated. I'd very much like to
I have one large div with one smaller div inside it. The smaller div
In following code, I have one large component, and I'd like only the level4
I have two large source trees. One of them has some out of date

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.