Your index 0 is not an int
in a string, but text in a string
.
You also got your indices wrong, use 0,1,2
int nb;
bool ok = int.TryParse(input[0], out nb); // ok is true if parsing succeeded
char tf = char.Parse(input[1]);
char bc = char.Parse(input[2]);
You should use int.tryParse()
to see if the int
parsing succeeded.