您好我一直在使用以下REST API: http://autocomplete.geocoder.nxt.api.here.com/6.2/suggest.json?query=100%20Parramatta%20Rd&app_id=XX&app_code=XX&country=AUS
过去的结果是:
{
"Label": "100 Parramatta Road, AUBURN NSW 2144",
"Postcode": "2144",
"State": "",
"UnitNo": "",
"StreetNo": "",
"AddressLine1": "",
"AddressLine2": "",
"Suburb": "",
"City": null,
"Country": null,
"BuildingName": null
}
但最近,“标签”的内容是落后的:
{
"Label": "Australia, NSW, Croydon, 100 Parramatta Rd",
"Postcode": "2132",
"State": "NSW",
"UnitNo": "",
"StreetNo": "100",
"AddressLine1": "Parramatta Rd",
"AddressLine2": null,
"Suburb": "Croydon",
"City": "Sydney",
"Country": "Australia",
"BuildingName": null
}
有什么建议吗?
谢谢:)
编辑添加一个更明显的问题:
我应该怎样做才能使标签看起来像第一个?我希望它是“100 Parramatta Road,AUBURN NSW 2144”,而不是“澳大利亚,新南威尔士州,克罗伊登,100 Parramatta Rd”
答案 0 :(得分:0)
如果这就是您要查询的API正在输出的内容,那么除非它可以通过您的API调用以某种方式进行配置,否则您无法做到这一点。您最好的选择是咨询API文档。
话虽如此,如果您只需要"Australia, NSW, Croydon, 100 Parramatta Rd"
代替"100 Parramatta Rd, Croydon, NSW, Australia"
,您可以尝试将字符串拆分为,
,然后将其翻转。
// the code below is in C#
var reverseLabel = string.Join(", ", result.Label.Split(',').Reverse());