示例#1
0
        /// <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)));
        }
示例#2
0
        /// <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);
            }
        }
示例#3
0
 /// <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));
 }
示例#4
0
 /// <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;
 }
示例#5
0
 /// <summary>
 /// Construtor parametrizado.
 /// </summary>
 /// <param name="value"></param>
 /// <param name="itemCase"></param>
 public FormatToken(char value, MaskCase itemCase) : this(value, value.GetMaskFormat(), itemCase)
 {
 }