Skip to content

tallesl/net-Cep

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Cep

Sanitizes CEPs and scraps addresses from Correios website.

Sanitizing

Checks the given CEP for the following formats:

  • ##.###-###;
  • #####-###;
  • ########.

Strips its mask and returns it. It can also be used for validation, if the CEP is invalid it returns null.

using CepLibrary;

Cep.Sanitize("30130-010"); // returns "30130010"
Cep.Sanitize("whatever");  // returns null

Scraping

Requests buscacep.correios.com.br and scraps a fresh address info.

using CepLibrary;

Cep.Scrap("30130010");

// returns the following:
//
// new Endereco
// {
//      Cep = "30130010",
//      Logradouro = "Praça Sete de Setembro",
//      Bairro = "Centro",
//      Localidade = "Belo Horizonte",
//      Uf = "MG"
// }

About

Sanitizes CEPs and scraps addresses from Correios website.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages