this is probably a super simple question. But I have this Array that I need to strip useless parts from. But I still want it in an array.
So, the array looks like this when it comes in:
ArrValues(0) "Firstname=FIRSTNAME"
ArrValues(1) "Lastname=LASTNAME"
ArrValues(2) "Username=USERNAME"
ArrValues(3) "Displayname=DISPLAYNAME"
Then I send this array through this code snippet:
For Each s In arrValues
s = Split(s, "=")
s = s(1)
Next
This strips the strings so I get only FIRSTNAME
and so on.
But, I want to send each cleaned string into an array again. How do I do that?
To write back to the array, you need to use the ArrValues(index) = new_value
notation. So, you need to use a regular For
loop instead of For Each
, and access the array elements by their indexes. Here's how you can do this:
For i = LBound(ArrValues) To UBound(ArrValues)
s = ArrValues(i)
s = Split(s, "=")
ArrValues(i) = s(1)
Next
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With