Exemplo n.º 1
0
 /// <summary>
 /// For a simple yes/no question where 'y' is true
 /// </summary>
 public static Validator <bool> Bool()
 {
     return(response => Regex.IsMatch(response, "^(y|n|yes|no)$", RegexOptions.IgnoreCase) ?
            Validated <bool> .Success(response.StartsWith("y", StringComparison.OrdinalIgnoreCase)) :
            Validated <bool> .Error("Please enter 'y' or 'n'."));
 }