public void ParsePosition(string positionInput) { var commands = positionInput.Split(' '); if (commands.Length != 3 || !char.IsNumber(commands[0], 0) || !char.IsNumber(commands[1], 0) || !char.IsLetter(commands[2], 0)) { throw new Exception("The position input must consist of 2 numbers and a letter, seperated by spaces"); } if (!Orientations.Contains(commands[2])) { throw new Exception( $"The last letter of the input string must be a cardinal compass point (case sensitive). E.g. {string.Join(", ", Orientations)}"); } TmpX = Convert.ToInt32(commands[0]); TmpY = Convert.ToInt32(commands[1]); TmpOrientation = commands[2]; var message = $"{TmpX} {TmpY} {TmpOrientation}"; }