string
-
This is my string below: <ProcessData Process="GetAllData" Result="Success" OutputId="Success" Records="1" User="myUserName" Name="GetAll" ProcessItemId="b2494f34-2ed8-41f5-b889-dbaa4aedb1c9" /> Notice that there is Result="Success". It could be failure or something else too. I would like to get the value of Result from this string above. I am trying with indexof but can not get the value of success. How is this done please? Thanks
-
This is my string below: <ProcessData Process="GetAllData" Result="Success" OutputId="Success" Records="1" User="myUserName" Name="GetAll" ProcessItemId="b2494f34-2ed8-41f5-b889-dbaa4aedb1c9" /> Notice that there is Result="Success". It could be failure or something else too. I would like to get the value of Result from this string above. I am trying with indexof but can not get the value of success. How is this done please? Thanks
Use Regular Expressions
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
-
This is my string below: <ProcessData Process="GetAllData" Result="Success" OutputId="Success" Records="1" User="myUserName" Name="GetAll" ProcessItemId="b2494f34-2ed8-41f5-b889-dbaa4aedb1c9" /> Notice that there is Result="Success". It could be failure or something else too. I would like to get the value of Result from this string above. I am trying with indexof but can not get the value of success. How is this done please? Thanks
Isn't this the same question as you asked under the title "Web service"? Anyway, to take pity on you, here is one way: assuming your string is called input
int pos = input.IndexOf("Result=")+8;
int pos2 = input.IndexOf("'",pos);
string output = input.Substring(pos , pos2 - pos);All it takes is a few minutes in debug mode.
Bob Ashfield Consultants Ltd
-
This is my string below: <ProcessData Process="GetAllData" Result="Success" OutputId="Success" Records="1" User="myUserName" Name="GetAll" ProcessItemId="b2494f34-2ed8-41f5-b889-dbaa4aedb1c9" /> Notice that there is Result="Success". It could be failure or something else too. I would like to get the value of Result from this string above. I am trying with indexof but can not get the value of success. How is this done please? Thanks
The string you are uses does look a lot like XML. You could try using Linq to XML (http://msdn.microsoft.com/en-us/library/bb308960.aspx[^]).
XElement element = XElement.Parse(YourString);
string Result = element.Attribute("Result").ValueDawn is nature's way of telling you to go to bed.
-
This is my string below: <ProcessData Process="GetAllData" Result="Success" OutputId="Success" Records="1" User="myUserName" Name="GetAll" ProcessItemId="b2494f34-2ed8-41f5-b889-dbaa4aedb1c9" /> Notice that there is Result="Success". It could be failure or something else too. I would like to get the value of Result from this string above. I am trying with indexof but can not get the value of success. How is this done please? Thanks
-
This is my string below: <ProcessData Process="GetAllData" Result="Success" OutputId="Success" Records="1" User="myUserName" Name="GetAll" ProcessItemId="b2494f34-2ed8-41f5-b889-dbaa4aedb1c9" /> Notice that there is Result="Success". It could be failure or something else too. I would like to get the value of Result from this string above. I am trying with indexof but can not get the value of success. How is this done please? Thanks
As this is part of the thread below, you should have continued with that one rather than started off a new one.
arkiboys wrote:
I would like to get the value of Result from this string above.
You have already been told to SelectSingleNode to get this. Well, you can use this to return the OutputId value.
Deja View - the feeling that you've seen this post before.
-
Use Regular Expressions
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
-
Isn't this the same question as you asked under the title "Web service"? Anyway, to take pity on you, here is one way: assuming your string is called input
int pos = input.IndexOf("Result=")+8;
int pos2 = input.IndexOf("'",pos);
string output = input.Substring(pos , pos2 - pos);All it takes is a few minutes in debug mode.
Bob Ashfield Consultants Ltd