可以用正則表示式提出來stringstr="你那段程式碼";Regexreg=newRegex(@"\{""face"":(\d+),""sex"":(\d+),""nick"":""(\w+)"",""age"":(\d+),""province"":""(\w+)"",""uin"":(\d+),""stat"":(\d+),""country"":""(\w+)"",""city"":""(\w+)""\}");MatchCollectionmc=reg.Matches(str);foreach(Matchminmc){//stringface=m.Groups[1].ToString();stringsex=m.Groups[2].ToString();stringnick=m.Groups[3].ToString();stringage=m.Groups[4].ToString();stringprovince=m.Groups[5].ToString();stringuin=m.Groups[6].ToString();stringstat=m.Groups[7].ToString();stringcountry=m.Groups[8].ToString();stringcity=m.Groups[9].ToString();//資料讀出來,如果以後要用,就存到一個數組裡去}
可以用正則表示式提出來stringstr="你那段程式碼";Regexreg=newRegex(@"\{""face"":(\d+),""sex"":(\d+),""nick"":""(\w+)"",""age"":(\d+),""province"":""(\w+)"",""uin"":(\d+),""stat"":(\d+),""country"":""(\w+)"",""city"":""(\w+)""\}");MatchCollectionmc=reg.Matches(str);foreach(Matchminmc){//stringface=m.Groups[1].ToString();stringsex=m.Groups[2].ToString();stringnick=m.Groups[3].ToString();stringage=m.Groups[4].ToString();stringprovince=m.Groups[5].ToString();stringuin=m.Groups[6].ToString();stringstat=m.Groups[7].ToString();stringcountry=m.Groups[8].ToString();stringcity=m.Groups[9].ToString();//資料讀出來,如果以後要用,就存到一個數組裡去}