views:

59

answers:

1

I have a string that contains ?action=a&current=b&something=c i want to create a variable that i can do val = mymap['current']; Is there something in C# to parse this? or do i need to use a string.split and write my own func?

-edit- solved thanks to REA_ANDREW and Guy Starbuck (from the other thread).

using System.Web;
using System.Collections.Specialized;
//add System.Web reference to project
NameValueCollection q = HttpUtility.ParseQueryString(link.Substring(link.IndexOf("?")+1));
//value = q["key"]
+1  A: 

This question shows a really fit for purpose method:

http://stackoverflow.com/questions/68624/how-to-parse-a-query-string-into-a-namevaluecollection-in-net

using System.Collections.Specialized;

Andrew

REA_ANDREW