Beispiel #1
0
        /// <summary>
        /// Expands selected Latin glyphs
        /// into their decimal entity equivalent.
        /// </summary>
        /// <param name="glyphText">
        /// The <see cref="System.String"/>
        /// containing the glyphs.
        /// </param>
        /// <returns>
        /// Returns a <see cref="System.String"/>
        /// with decimal entities.
        /// </returns>
        public static string Expand(string glyphText)
        {
            if (_glyphs.Count == 0)
            {
                LatinGlyphs.AddGlyphs();
            }

            foreach (string s in _glyphs.Keys)
            {
                glyphText = glyphText.Replace(s, _glyphs[s]);
            }
            return(glyphText);
        }
Beispiel #2
0
        /// <summary>
        /// Condenses selected decimal entities
        /// into their Latin glyph equivalent.
        /// </summary>
        /// <param name="entityText">
        /// The <see cref="System.String"/>
        /// containing the decimal entities.
        /// </param>
        /// <returns>
        /// Returns a <see cref="System.String"/>
        /// with Latin glyphs.
        /// </returns>
        public static string Condense(string entityText)
        {
            if (_glyphs.Count == 0)
            {
                LatinGlyphs.AddGlyphs();
            }

            foreach (string s in _glyphs.Keys)
            {
                entityText = entityText.Replace(_glyphs[s], s);
            }

            //Search for selected named entities:
            entityText = entityText.Replace("&copy;", "©");
            entityText = entityText.Replace("&eacute;", "é");
            entityText = entityText.Replace("&nbsp;", " ");
            entityText = entityText.Replace("&reg;", "®");
            entityText = entityText.Replace("&trade;", "™");

            return(entityText);
        }