how to say this in VB?
-
I have one array with say 10 strings in it> i want to put a subset of these 10 strings that I will identify by name (but not by index) into another array. So I want to say that if the origArray[i] is "a", or "m" or "l" then put this into my new array newArray() , otherwise keep looking into the old array till its exhausted.. Thanks Appreciate your help, ns
-
I have one array with say 10 strings in it> i want to put a subset of these 10 strings that I will identify by name (but not by index) into another array. So I want to say that if the origArray[i] is "a", or "m" or "l" then put this into my new array newArray() , otherwise keep looking into the old array till its exhausted.. Thanks Appreciate your help, ns
I would make the second array an ArrayList.
Dim origArray() As String = {"a", "b", "c", "d", "e", "f", "m", "z", "l"}
Dim secondArray As ArrayList = New ArrayList()
Dim i As Integer = 0For i = 0 To (origArray.Length - 1)
Select Case origArray(i)
Case "a", "m", "l"
secondArray.Add(origArray(i).ToString)Case Else End Select
Next
Paul Watson wrote: "At the end of the day it is what you produce that counts, not how many doctorates you have on the wall." George Carlin wrote: "Don't sweat the petty things, and don't pet the sweaty things." Unknown wrote: "I love long walks, especialy taken by those that annoy me." Paraphrased from TMNT: "Cricket? You have to know what a crumpet is to understand Cricket."