示例#1
0
 public static bool VerificarValidadeDoCep(string CEP)
 {
     if (CEP.Trim().Length == 9)
     {
         return(System.Text.RegularExpressions.Regex.IsMatch(CEP, ("[0-9]{5}-[0-9]{3}")));
     }
     else if (CEP.Trim().Length == 8)
     {
         CEP = Formatacao.FormatarCEP(CEP);
         return(System.Text.RegularExpressions.Regex.IsMatch(CEP, ("[0-9]{5}-[0-9]{3}")));
     }
     else
     {
         return(false);
     }
 }
示例#2
0
 private static void FormatarCEP(string CEP)
 {
     Console.WriteLine(Formatacao.FormatarCEP(CEP));
 }