I have the following code, what i do is the following: I enter a string of numbers with the following format and what I do is debug and adopt the correct format, example: correct format: XXXX/XX
456/12 = 0456/12
25/1 = 0025/01
1/23 = 0001/23
/ = 0000/00
but what I don't take into account is that if what enters is an intger or not, if it is an integer it accepts it but it rejects it. for example:
A324/1 = FORMAT ERROR
458/P8 = FORMAT ERROR
How to solve this problem?
my code:
public static string Validate_Cc(string CourtCase)
{
// int i = 0;
string[] parts = CourtCase.Split('/');
var number1 = Int32.Parse(parts[0]);
var number2 = Int32.Parse(parts[1]);
if ((CourtCase.Length) > 7)
{
badLines(CourtCase);
}
return $"{number1:0000}/{number2:00}";
}