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

on Jul 23, 2019 04:49 AM

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
on Jul 23, 2019 04:56 AM


Without using array its not possible.

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