Solved

Remove element from an array in vbscript.

Posted on 2014-04-29
4
383 Views
Last Modified: 2014-04-29
I have an array named 'MemberGroup' which has a number of elements e.g.

Members = ("APPLES 145","BANANAS 234","CELERY 897","DOG 787","ENGINE 546","FLURIDE 878")

I am looking for the best way in vbscript that I can remove an element from this array that contains e.g. 234 - which would remove the BANANAS 234 element? It is important that the array reflects the correct new size and that the element order is not changed in any way.

I am sure this is very simple - any ideas?
0
Comment
Question by:Blowfelt82
  • 2
4 Comments
 
LVL 6

Expert Comment

by:Manuel Marienne-Duchêne
ID: 40029123
0
 
LVL 49

Accepted Solution

by:
Rgonzo1971 earned 500 total points
ID: 40029124
Hi,

You could use Filter

Members = Array("APPLES 145", "BANANAS 234", "CELERY 897", "DOG 787", "ENGINE 546", "FLURIDE 878")
NewMembers = Filter(Members, " 234", False)

Open in new window

Regards
0
 
LVL 49

Expert Comment

by:Rgonzo1971
ID: 40029133
@ manumd

Blind links are not acceptable answers
See
http://support.experts-exchange.com/customer/portal/articles/1162518

Regards
0
 

Author Closing Comment

by:Blowfelt82
ID: 40029155
Perfect answer - thanks,
0

Featured Post

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Welcome, welcome!  If you are new to the series and haven't been following along, please take a brief moment to review the first three installments: Part 1 (http://www.experts-exchange.com/Programming/Languages/Visual_Basic/VB_Script/A_266-VBScri…
Over the years I have built up my own little library of code snippets that I refer to when programming or writing a script.  Many of these have come from the web or adaptations from snippets I find on the Web.  Periodically I add to them when I come…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

778 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question