Assuming you're using PHP, you can do something like this.
PHP Code:
$add_bits = explode(' ',$address);
/* Returns Array like
$add_bits
{
0 => 123
1 => Elm
2 => Creek
3 => Cir
}
*/
/* Assuming the Kind of road is the last element, do */
$highest_key = count($add_bits); # Returns 4
$road = strtolower($add_bits[$highest_key]);
/* Parse through Possibilities */
switch($road)
{
case 'rd':
case 'road':
$type = 'Road';
break;
case 'st':
case 'str':
case 'street':
$type = 'Street':
break;
case 'cir':
case 'cr':
case 'circ':
case 'circle':
$type = 'Circle';
break;
/* Etc */
}
You May Want to do some error checking to make sure the last item is not a directional thing such as
2300 E St NW
But that can give you a jumping off point.
Aaron
Bookmarks