1// verifie le format d'un String de numero de telephone et ajuste le format
2// Format possible : xxxxxxxxxx || xxx xxxxxxx || xxxxxx xxxx || xxx xxx xxxx
3// xxx-xxxxxxx || xxxxxx-xxxx || xxx-xxx xxxx || xxx xxx-xxxx || xxx-xxx-xxxx
4// (xxxxxxxxxx || xxx)xxxxxxx || (xxx xxxxxxx || xxx) xxxxxxx || (xxx-xxxxxxx
5// etc.
6// Format final : (xxx)xxx-xxxx
7if(numero.matches("\(?(\d{3})\)?[- ]?(\d{3})[- ]?(\d{4})")){
8 newNumero = numero.replaceFirst("\\(?(\\d{3})\\)?[- ]?(\\d{3})[- ]?(\\d{4})", "($1)$2-$3");
9}