/// <summary> /// Indica se se trata de um caractere no intervalo A a Z. /// </summary> /// <param name="instance"></param> /// <param name="itemCase"></param> /// <returns></returns> public static bool IsAlphabetic(this char instance, MaskCase itemCase = MaskCase.Normal) { switch (itemCase) { case MaskCase.Lower: return(('a' <= instance) && ('z' >= instance)); case MaskCase.Upper: return(('A' <= instance) && ('Z' >= instance)); } return((('a' <= instance) && ('z' >= instance)) || (('A' <= instance) && ('Z' >= instance))); }
/// <summary> /// Determina se o item atende a especificação de maiísculas/minúsculas fornecida. /// </summary> /// <param name="instance"></param> /// <param name="itemCase"></param> /// <returns></returns> public static bool IsCaseMatch(this char instance, MaskCase itemCase) { switch (itemCase) { case MaskCase.Lower: return(!Char.IsUpper(instance)); case MaskCase.Upper: return(!Char.IsLower(instance)); default: return(true); } }
/// <summary> /// Indica se se trata de um caractere do alfabeto ou de dígito. /// </summary> /// <param name="instance"></param> /// <param name="itemCase"></param> /// <returns></returns> public static bool IsAlphaNumeric(this char instance, MaskCase itemCase = MaskCase.Normal) { return(instance.IsNumeric() || instance.IsAlphabetic(itemCase)); }
/// <summary> /// Construtor parametrizado. /// </summary> /// <param name="value"></param> /// <param name="format"></param> /// <param name="itemCase"></param> public FormatToken(char value, MaskFormat format, MaskCase itemCase) { _value = value; _format = format; _itemCase = itemCase; }
/// <summary> /// Construtor parametrizado. /// </summary> /// <param name="value"></param> /// <param name="itemCase"></param> public FormatToken(char value, MaskCase itemCase) : this(value, value.GetMaskFormat(), itemCase) { }