The issue is that addresses themselves come in all shapes and sizes and they are not self-validating entities. This means that there is no way to really know if you did it right without inspecting the address by hand (and even then it can be error prone) or by using some kind of address verification software--be it desktop-based software or online.
There are a number of address verification web services that can take an address and break it into its component parts and do so in a safe manner where the results have been certified to be valid.
I should mention that I'm the founder of SmartyStreets. We do address verification which includes the capabilities that you have asked about for US-based addresses. Our flagship product is US Address API which is an address verification web service API.