高软玩家

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理
            string txt = "{\"ip\": \"127.0.0.1\", \"port\": 80, \"status\": \"NULL\", \"type\": \"ee\", \"arg\": \"admin:123456\"},";
            Match m = Regex.Match(txt, @"""(.*?)"":(.*?),");
            while (m.Success)
            {
                string key = m.Groups[1].Value.Replace("\"", "").Replace(",", ""); ;
                string vule = m.Groups[2].Value;
                if (!dic.ContainsKey(key))
                    dic.Add(key, vule);
                m = m.NextMatch();
            }

 

posted on 2018-11-07 15:44  高软玩家  阅读(904)  评论(0编辑  收藏  举报