private void ButtonSearchCep_Clicked(object sender, EventArgs e) { //used replace for remvoving the mask char and trim to remove any possible white-spaces var cep = entryCep.Text.Replace("-", "").Trim(); if (isValidCep(cep)) { try { address = ViaCepService.searchAddress(cep); if (address.erro == true) { //called entryCep to show masked text textResult.Text = string.Format("Endereço não encontrado para o CEP: {0}", entryCep.Text.Trim()); } else { textResult.Text = "Logradouro: " + address.logradouro + "\nBairro: " + address.bairro + "\nCidade: " + address.localidade + "\nUF: " + address.uf; } } catch (Exception exception) { DisplayAlert("ERRO CRÍTICO", exception.Message, "OK"); } } }