Exemple #1
0
        /// <summary>
        /// Gets the numerical character reference value.
        /// </summary>
        /// <param name="str">The STR.</param>
        /// <returns></returns>
        protected string GetNumericalCharacterReferenceValue(string str)
        {
            if (str != null && str.Length > 1)
            {
                if (str[0] == '#')
                {
                    int val;
                    if (str[1] == 'x' || str[1] == 'X')
                    {
                        val = ConversionUtilities.ParseHex(str.Substring(2));
                    }
                    else
                    {
                        val = ConversionUtilities.ParseInt(str.Substring(1));
                    }

                    if (val > 0)
                    {
                        return(((char)val).ToString());
                    }
                }
            }
            return(null);
        }