I have a string array being passed and I need to grab everything from it and call a routine based on the prefix, however, my foreach loop is only grabbing the last value passed in. How can I grab everything and pass it to the routine as value1;value2;value3.
the string array looks like this:
New_BMWX5;New_BMWX3;Used_LexusIS;Used_AudioQ8
I have the following:
dim enteredModels as String = car.Values 'this is the variable for the values being passed in
dim cars as String()
dim inventory as String = ""
cars = enteredModels.Split(";")
for each c as String in cars
if c.Contains("New") or (c.Contains("Used")) then
car.Values = c
inventory = String.Join(";", c.ToArray())
' if the values of a prefix of new or used they call this
carInventory.SubCars(c, "#", grp.ReplaceChars)
else
car.Values = c
inventory = String.Join(";", c.ToArray())
' if the values have no prefix, they call it like this
carInventory.SubCars(c, grp.ChangeFormat grp.ReplaceChars)
end if
Next
The issue I'm running into is that, it's only taking the last value from the string array, how can I call the correct routine and when I have values with and without prefixes in the string array?