Created
October 5, 2018 21:01
-
-
Save pedrovasconcellos/10e06942bd4667855b57c77d084dcc96 to your computer and use it in GitHub Desktop.
Verifica se a Placa do Veículo é aderente as características da Placa do Merco Sul
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static class VerificarPlacaMercoSul | |
{ | |
public int VerificarPlacaMercoSul(string placa){ | |
if(placa?.Count() != 7) return -1; | |
//Verifica se o último caractere é um número; | |
if(!Regex.IsMatch(placa[placa.Count()-1].ToString(), @"^(|[0-9])+$")) return -2; | |
//Verifica se a placa contempla apenas letras e números; | |
if(!Regex.IsMatch(placa, @"^([a-zA-Z]|[0-9])+$")) return -3; | |
return 1; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment