I am using C#
I got a string which looks something like this :
myString = "User1:John&User2:Bob'More text"
I used
var parsed = HttpUtility.ParseQueryString(myString);
and then i use parsed["User1"]
and parsed["User2"]
to get the data.
My problem is that parsed["User2"]
returns me not only the name but also everything that comes after it.
I thought maybe to then seperate by the char '
But i not sure how to do it since it has a specific behaviour in Visual studio.
I thought about something like this?
private static string seperateStringByChar(string text)
{
int indexOfChar = text.IndexOf(');
if (indexOfChar > 0)
{
return text.Substring(0, indexOfChar);
}
else
{
return "";
}
}