I am running into a bit of a problem with ByVal in VBScript. Here's a quick sample script that I wrote to illustrate the issue:
<%
Option Explicit
dim PublicDict
Set PublicDict = createobject("Scripting.Dictionary")
PublicDict.Add "MyKey", "What's up doc?"
response.write OutputStringFromDictionary( PublicDict ) & "<br />"
response.write PublicDict("MyKey")
Set PublicDict = nothing
Function OutputStringFromDictionary( ByVal DictionaryParameter )
DictionaryParameter("MyKey") = replace(DictionaryParameter("MyKey"), "'", "''")
OutputStringFromDictionary = DictionaryParameter("MyKey")
end Function
%>
This script outputs these lines to the browser:
What''s up doc?
What''s up doc?
I was hoping to get:
What''s up doc?
What's up doc?
How do I make it so that OutputStringFromDictionary
doesn't modify the original dictionary?