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

PRA
 
on Jul 23, 2019 04:49 AM
1439 Views

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

Download FREE API for Word, Excel and PDF in ASP.Net: Download
dharmendr
 
on Jul 23, 2019 04:56 AM

Hi PRA,

Without using array its not possible.

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