1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
| function smallClean($str){
$str=strtoupper( trim($str) );
$str=preg_replace("`(^|\W)(BD)(\W|$)`si","\\1BOULEVARD\\3", $str);
$str = preg_replace("`(^|\W)(ST)(\W|$)`si","\\1SAINT\\3", $str);
$str = preg_replace("`(^|\W)(STE)(\W|$)`si","\\1SAINTE\\3", $str);
$str = str_replace('/', ' SUR ', $str);
$str = str_replace("'", ' ', $str);
$str = preg_replace("`(^|\W)(À)(\W|$)`si","\\1\\3", $str);
$str = preg_replace("`(^|\W)(A)(\W|$)`si","\\1\\3", $str);
$str = preg_replace("`(^|\W)(D)(\W|$)`si","\\1\\3", $str);
$str = preg_replace("`(^|\W)(L)(\W|$)`si","\\1\\3", $str);
$str = preg_replace("`(^|\W)(AU)(\W|$)`si","\\1\\3", $str);
$str = preg_replace("`(^|\W)(DE)(\W|$)`si","\\1\\3", $str);
$str = preg_replace("`(^|\W)(DU)(\W|$)`si","\\1\\3", $str);
$str = preg_replace("`(^|\W)(LE)(\W|$)`si","\\1\\3", $str);
$str = preg_replace("`(^|\W)(LA)(\W|$)`si","\\1\\3", $str);
$str = preg_replace("`(^|\W)(AUX)(\W|$)`si","\\1\\3", $str);
$str = preg_replace("`(^|\W)(DES)(\W|$)`si","\\1\\3", $str);
$str = preg_replace("`(^|\W)(LES)(\W|$)`si","\\1\\3", $str);
return trim($str);
}
function formatRue($str){
$str = smallClean($str);
$str=preg_replace("`(^|\W)(ROUTE FORESTIÈRE|VOIRIE COMMUNALE|PETIT CHEMIN|CHEMIN RURAL|GRANDE ALLÉE| ... |PONT|PORT|QUAI|VOIE|ÎLE|RUE)(\W|$)`si","\\1\\3", $str);
return trim($str);
} |
Partager