在C#中,我得到了下面的字符串:如何在C#中分割該字符串並獲取第一個和最後一個經緯度?
[{"place_id":"92911594","licence":"Data \u00a9 OpenStreetMap contributors, ODbL
1.0. http:\/\/www.openstreetmap.org\/copyright","osm_type":"way","osm_id":"12174
8552","boundingbox":["-33.4480414","-33.4439319","-70.6448054","-70.6266944"],"l
at":"-33.4460658","lon":"-70.6359402","display_name":"Mar\u00edn, Santiago, Prov
incia de Santiago, XIII Regi\u00f3n Metropolitana de Santiago, 8331059, Chile","
class":"highway","type":"tertiary","importance":0.2,"address":{"road":"Mar\u00ed
n","city":"Santiago","county":"Provincia de Santiago","state":"XIII Regi\u00f3n
Metropolitana de Santiago","postcode":"8331059","country":"Chile","country_code"
:"cl"},
"svg":"M -70.626694400000005 33.444016900000001 L
-70.626853100000005 33.443931900000003
-70.628024600000003 33.444266200000001
-70.629083399999999 33.444542800000001
-70.629957200000007 33.444764300000003
-70.630791099999996 33.444983999999998
-70.630836099999996 33.4449915
-70.631027500000002 33.445031299999997
-70.631102900000002 33.445044099999997
-70.631955300000001 33.445186900000003
-70.632777300000001 33.445343999999999
-70.632846900000004 33.445356799999999
-70.6329025 33.445371799999997
-70.633783199999996 33.445576199999998
-70.63402120 0000007 33.445624299999999
-70.635066499999994 33.4458354
-70.635940199999993 33.4460658
-70.637316900000002 33.446388900000002
-70.638039300000003 33.446610700000001
-70.638551500000005 33.446730799999997
-70.639778699999994 33.447019400000002
-70.640489099999996 33.4471962
-70.641005800000002 33.4473074
-70.642197100000004 33.447521299999998
-70.642251900000005 33.447535500000001
-70.643692900000005 33.4478121
-70.644805399999996 33.448041400000001
"}]
我需要得到和某些變量保存從SVG每個LAT-長着一雙。例如:
pair1 = "-70.626694400000005 33.444016900000001"
pair2 = "-70.626853100000005 33.443931900000003"
pairx = ""
我tryng與拆分,但我不能得到使用正則表達式對。
這串* *是一個JSON強,使用http://json2csharp.com/來爲您的JSON類,解析您的字符串到你的對象*(反序列化) *並且你會得到一個'svg'字符串類型的屬性。在空間上分割並得到'First'和'Last' – Habib 2014-11-24 16:56:03
你會在你的數據之前總是得到''svg「:」M'嗎? – Tariq 2014-11-24 16:56:39
你需要?很好!當你的編碼問題比你歡迎回來! – Vladimirs 2014-11-24 16:58:04