Exemplo n.º 1
0
        /// <summary>
        /// Determines whether the specified value is hexadecimal.
        /// Deals with null strings
        /// </summary>
        /// <param name="source">The source.</param>
        /// <returns>
        ///   <c>true</c> if the specified text is hex; otherwise, <c>false</c>.
        /// </returns>
        public static bool IsHex(this string source)
        {
            if (string.IsNullOrEmpty(source))
            {
                return(false);
            }

            return(HexRegex.IsMatch(source.Trim().ToLower()));
        }
Exemplo n.º 2
0
        private static bool IsValidColor(string?color)
        {
            if (string.IsNullOrWhiteSpace(color))
            {
                return(false);
            }

            return(HexRegex.IsMatch(color));
        }