/// <summary>
        /// Determines whether the specified string is a valid percent value.
        /// </summary>
        /// <param name="p_strVal">The string value.</param>
        /// <param name="provider">The provider.</param>
        /// <returns>
        ///   <c>true</c> if the specified string is a valid percent value; otherwise, <c>false</c>.
        /// </returns>
        public static bool IsPercentString(string p_strVal, System.IFormatProvider provider)
        {
            if (p_strVal == null)
            {
                return(false);
            }

            NumberFormatInfo l_Info;

            if (provider == null)
            {
                l_Info = CultureInfo.CurrentCulture.NumberFormat;
            }
            else
            {
                l_Info = (NumberFormatInfo)provider.GetFormat(typeof(NumberFormatInfo));
            }

            return(p_strVal.IndexOf(l_Info.PercentSymbol) != -1);
        }
Пример #2
0
        public static bool IsPercentString(string p_strVal, System.IFormatProvider provider)
        {
            System.Globalization.NumberFormatInfo l_Info;
            if (provider == null)
            {
                l_Info = System.Globalization.CultureInfo.CurrentCulture.NumberFormat;
            }
            else
            {
                l_Info = (System.Globalization.NumberFormatInfo)provider.GetFormat(typeof(System.Globalization.NumberFormatInfo));
            }

            if (p_strVal.IndexOf(l_Info.PercentSymbol) == -1)
            {
                return(false);
            }
            else
            {
                return(true);
            }
        }