如何解析地址 [英] how to parse address

查看:95
本文介绍了如何解析地址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我想要一个代码来解析地址

如果我输入完整地址,则需要2解析为
街道,地区,州,国家/地区,邮政编码
前:: MS H WILLIAMS
财务与会计
澳大利亚邮政
新南威尔士州1427,草莓山,克莱夫兰街219-241号
请告诉我逻辑

谢谢和问候

Amol

Hi,

I want a code to parse a address

if i enter full address i need 2 parse it as
street ,locality,state,country city,postal code
ex :: MS H WILLIAMS
FINANCE AND ACCOUNTING
AUSTRALIA POST
219-241 CLEVELAND ST,STRAWBERRY HILLS NSW 1427

Please tell me the logic

Thanks and regards

Amol

推荐答案

由于您没有为它们提到单独的输入,因此假设您将所有输入放在同一行中,那么很难解析并获得所有输入他们.

原因是,您的输入条件并未限制用户输入每个字段.它们可能会跳/吃掉某些部分!

尽管如此,解析它的方法仍然是使用enter/逗号作为定界符,然后尝试查找其中的每一个表示什么.由于根据世界上任何地方的地址可能的组合数量,这将导致非常糟糕的性能,因此,建议您将输入作为单独的字段使用.

喜欢:
街道1文本框,位置1文本框,州1文本框...等等.
Since you have not mentioned separate inputs for them, assuming you take all of them in a single line, it would be really difficult to parse and get all of them.

Reason being, your input criteria is not putting a constraint on user to enter each of the field. They might jump/eat of some parts!

Still, the way to parse it would be to use enter/comma as delimiter and then try to find what wach of them signify. Since this would be having very bad performance based on number of combinations possible for an address anywhere in the world, I would suggest you to take the inputs as separate fields.

Like:
Street 1 textbox, Locality 1 textbox, State 1 textbox... etc.


这篇关于如何解析地址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆