I have following string:
OK:<IDP RESULT="0" MESSAGE="some message" ID="oaisjd98asdh339wnf" MSGTYPE="Done"/>
I use this method to parse and get result:
public string MethodName(string capt)
{
var receivedData = capt.Split(' ').ToArray();
string _receivedReultValue = "";
foreach (string s in receivedData)
{
if (s.Contains('='))
{
string[] res = s.Split('=').ToArray();
if (res[0].ToUpper() == "RESULT")
{
string resValue = res[1];
resValue = resValue.Replace("\\", " ");
_receivedReultValue = resValue.Replace("\"", " ");
}
}
}
return _receivedReultValue.Trim();
}
Is there better way to parse string like this to extract data?