Get Address Breakdown From Text / String

Posted on 2009-02-19
Last Modified: 2013-12-17
I am looking for c# code and/or addin/utility to take a string and return to me the address information from the string. Here are some examples...

String - Joe Smith, 123 Main St, New York, New York 55555
Returns: Address = 123 Main St.; City = New York; State = New York; ZIP = 55555; ZIP4 = {blank}

String - 1000 W Main Avenue New York, NY 51515-0001
Returns: Address = 1000 W Main; City = New York; State = NY; ZIP = 51515; ZIP4 = 0001

This address string is provided to me in many ways. Sometimes it will have person/business name in it. Sometimes it will just be the address. This address is provided in one long string and I need a tool to break this string into the specifics of the address and the code needs to account for a variety of situations. In some cases, there may be a PO Box and street for the address. In some cases, there may be apartment or suite information. Yes, I need to handle a wide range of possibilities. In some cases, some items may be separated by commas and in others there is nothing separating except a space.

I should also state that I need to break the address into further parts also, such as House Number, House Number Fraction, Direction, Street, Sub Location 1, Sub Location 2, Sub Location 3. Sub Locations would be for apartments, suites, etc. If it code can do basic breakdown and not get to this detail, it may still be acceptable for the application I need to put this into.

Looking forward to your responses.

Jody Wood
Question by:JodyWood
    LVL 26

    Expert Comment

    by:Anurag Thakur
    the processing you want to do can only be possible if your string is in one format only
    the sample strings you have provided contains data in different formats so thats why the breakdown will be slightly difficult
    if the string is in one consistent format then it might be easier even withr egular expressions to do that

    Author Comment

    I understand what you are saying, but that is the challenge I face that it is not always in the same format and I have no control over that. Thus, the challenge at hand.

    I know mapping web sites handle this, so there must be a way.

    Accepted Solution

    No solution has been provided. How do I pull my points offered on the question for later use? There should be no points awarded.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    6 Surprising Benefits of Threat Intelligence

    All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

    Suggested Solutions

    Normally a window is moved by clicking on the caption bar and dragging. You may want your user to be able to move borderless forms or move a form by clicking anywhere in the form without the limitation to the caption bar. There are many ways to do i…
    In my previous article ( we saw the basics of serialization and how types/objects can be serialized to Binary format. In this blog we wi…
    This video discusses moving either the default database or any database to a new volume.
    This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor ( If you're looking for how to monitor bandwidth using netflow or packet s…

    794 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now