Encode a string of text, "escaping" all characters that are not allowable in web url address strings.


   String    The string of text to convert to an encoded string for use with HTML data transfer.

Note some web browsers will display URLs even without properly escaped characters. HTML with unescaped punctuation will fail validation.


Option Explicit

Dim strMessage
strMessage = "Sample text with (parentheses) spaces & " & Chr(34) & "quotes" & Chr(34)

MsgBox strMessage& vbCR & Escape(strMessage), vbOkOnly+vbInformation, "Demo"

“Writing is a form of therapy; sometimes I wonder how all those, who do not write, compose, or paint can manage to escape the madness, the melancholia, the panic fear, which is inherent in a human condition” ~ Graham Greene

Related VBScript commands

UnEscape - Return Unicode characters from an escaped ASCII string.

Copyright © 1999-2024
Some rights reserved