I want the first two and the last 4 characters to be numbers and the rest to remain as strings. If these conditions are not met, the license plate number should be obtained again.I couldn't go further than the code below.
static string PlakaAl(string plaka)
{
int sayi;
while (true)
{
Console.Write(plaka);
string giris = Console.ReadLine();
if (giris.Length == 8 && int.TryParse(giris.Substring(0, 2), out sayi) == true && int.TryParse(giris.Substring(4, 4), out sayi == true)
{
return plaka;
}
else
{
Console.WriteLine("Bu şekilde plaka girişi yapamazsınız. Tekrar deneyin.");
}
}