Retrieve (Extract) value from string in C# and VB.Net

Last Reply one month ago By dharmendr

Posted one month ago

Hi! I used below code get result, but I want don't use array. 

int KOD;
string result = "{KOD=10,NAME=Dantist}";
string[] data = result.ToString().Split(',');
string[] dt = data[0].Split('=');
KOD = Convert.ToInt32(dt[1].ToString());

result output: KOD=10

Posted one month ago

Hi PRA,

Without using array its not possible.

You need to split the string and using the array index get the value.