日期:2014-05-17  浏览次数:20430 次

求高手帮忙 解析一个字符串?
{
"info":{
"type":45,
"error":0,
"time":69
},
"detail":{
"city":"郑州市",
"district":"中原区",
"gps_type":"5",
"name":"中原路立交桥",
"pcd_conflict_flag":"0",
"pointx":"113.584757",
"pointy":"34.754009",
"province":"河南省",
"query_status":"0",
"server_retcode":"0",
"similarity":"0.712545"
}
}



解析这个字符串  ,获取里面的pointx和pointy对应的值

------解决方案--------------------
string[] result = Regex.Matches(文本, @"\d(2,3)\.\d+").Cast<Match>().Select(x => x.Value).ToArray();
------解决方案--------------------
 
string str="字符串";
 Match m = Regex.Match(str, @"(?is)""pointx"":""(\d+(\.\d+)?)"".*?""pointy"":""(\d+(\.\d+)?)""");
            Console.WriteLine(m.Groups[1].Value);
            Console.WriteLine(m.Groups[3].Value);