How to refer values(key/value) in string Array

Hi,

I have below array:

arr = {“ID:11”, “Name:Sonali”}

I am able to do split like below:
arrCols(0).Split(":“c)(0) which gives me ID and then arrCols(0).Split(”:"c)(1) gives me 11

To be able to refer values this way, i will have to remember the index of the key/value i am trying to use, there will be approx. 20 key value pairs in my array.

So, I want to refer these values by their key, is there any better/easier way to access the values?

Regards
Sonali

Hi @sonaliaggarwal47

Can you try using dictionary

dictData = arr.ToDictionary(Function(x) x.Split(":"c)(0).Trim(), Function(x) x.Split(":"c)(1).Trim())

dictData("ID")  
dictData("Name") 

Regards,

2 Likes

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.