i have a string like this:
blablablamorecontentblablabla?name=michel&score=5&age=28&iliedabouttheage=true
looks like a regular query string yes, but i'm not in any web context
now i want to extract the values (after the = sign) by their key , for example,what is the name (michel), the score(5), the age(28) etc.
Normally i parse the string like get the position in the string of the word 'name', then add 5 to it (length of 'name=') and name this position 'start' then search for the &-sign and name that position 'end', and then get the string between the position start and end.
But there must be a better solution, is this a regex thing?
Try System.Web.HttpUtility.ParseQueryString, passing in everything after the question mark. You would need to use the System.Web assembly, but it shouldn't require a web context.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With