Created
November 3, 2014 11:53
-
-
Save neelsg/eae9aacde4ec0a2f184b to your computer and use it in GitHub Desktop.
Functions to decode or encode text for use in an XML file. VBScript / VBA
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Public Function DecodeXml(TextToDecode As String) As String | |
'Take text that has been encoded for XML and change it to normal text | |
Dim Res As String | |
Res = Replace(Replace(Replace(Replace(TextToDecode, """, """"), ">", ">"), "<", "<"), "&", "&") | |
DecodeXml = Res | |
End Function | |
Public Function EncodeXml(TextToEncode As String) As String | |
'Take text and change special chars so that it can be included in an XML file | |
Dim Res As String | |
Res = Replace(Replace(Replace(Replace(TextToEncode, "&", "&"), ">", ">"), "<", "<"), """", """) | |
EncodeXml = Res | |
End Function |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
you forgot replace single quote ' to '