All pastes #111723 Raw Edit

Mine

public text v1 · immutable
·published 2006-08-02 12:52 UTC
rendered paste body
   Public Function GetHTMLEncoding(ByVal Input As String) As String
      Dim p As Xml.XmlDocument = New Xml.XmlDocument
      With p.CreateTextNode(Input)
         Return (.OuterXml)
      End With
   End Function

   Public Function GetHTMLDecoding(ByVal Input As String) As String
      Dim p As Xml.XmlDocument = New Xml.XmlDocument
      p.LoadXml("<p>" & Input & "</p>")
      Return p.SelectSingleNode("p").InnerText
   End Function


'usage examples..

      MsgBox(GetHTMLEncoding("prashant& owns& it&"))
      MsgBox(GetHTMLDecoding("prashant &amp; owned &amp; it! &amp;"))