Function String Extras Class

PrefixHTMLMetaCharacters

Fixes-up a string literal so that none of the characters within it will have unintended special meanings when used within HTML documents.

Signature (Visual Basic / VBA)

Public Function PrefixHTMLMetaCharacters( _
    ByVal vString As Variant _
    ) As Variant

Code Examples

    PrefixHTMLMetaCharacters("A & B") = "A & B"
    & becomes &
    < becomes &lt;
    > becomes &gt;

Parameters

Parameter Description
vString String containing characters which should be interpreted literally when read as HTML. Function returns Null if vString is Null or cannot be fixed up to a String.

Notes & Version History

Summary Any characters such ampersands (&), less than signs (<), and greater than signs (>) are replaced by the appropriate HTML phrase so that they can be placed within HTML documents without their being interpreted as having some special meaning. For example, HTML browsers interpret less-than signs (<) as the beginning of some HTML code phrase. This function assures that the most important such characters with special meanings will be interpreted literally using the rules for HTML.
Note This function currently supports the following translations:
Note There may be other ANSI Windows characters for which there is an ampersand-semicolon sequence, but this function only makes the translations mentioned in the above list.
Note HTML stands for Hypertext Markup Language, which is a subset of SGML. SGML stands for Standard Generalized Markup Language.