Search code examples
vbscripturl-encodingurldecode

How to remove amp; from URL


I am getting a URL that contains amp;. Is there any way to remove this as currently I tried URLDecode function, but It's not working. Do I need to remove It using simple string replacement or Is there any better way to do this?


Solution

  • As @Lankymart pointed out URLDecode only works on URL-encoded characters (%26), not on HTML entities (&). Use a regular string replacement to change the HTML entity & into a literal ampersand:

    url = Replace(url, "&", "&")