开发者

Java recognizing address information and breaking it apart into variables (no regex)

Does anyone have a recommended pseudo-algorithm for, given a string containing an address:

Bre开发者_开发百科ak apart the address apart into a Street variable, a City variable, a State variable, and a Zip variable

The address string may be formatted in a number of different ways. For example, it may be comma separated or it may be separated by spaces. Also, the address may only contain a city and state, and not a street address or zip code. Similarly, it may contain a street, city, state, and not a zip code.

To make things harder, I cannot use regular expressions (as I am developing on a mobile platform that does not support it).

Thanks!


No, but look at JGeocoder:

http://jgeocoder.sourceforge.net/parser.html

They split addresses up into their constituent parts. You could take a look at the source for that...


Here is a cool solution using Google Maps provided by John. May be you want to use that :

Java postal address parser

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜