| Active Server Pages: Dictionary |
In this example we have change the value "one" to "1".
The resulting page will show the value "uno".
| translate.asp |
| <%
SET MyDictionary=CreateObject("Scripting.Dictionary") MyDictionary.Add "one","uno"EnglishNumber="1" SpanishNumber=MyDictionary.Item (EnglishNumber) Response.Write(SpanishNumber) %> |
In this example we have change the value "dos" to "2".
The resulting page will show the value "2".
| translate.asp |
| <%
SET MyDictionary=CreateObject("Scripting.Dictionary") MyDictionary.Add "one","uno"EnglishNumber="two" SpanishNumber=MyDictionary.Item (EnglishNumber) Response.Write(SpanishNumber) %> |
Example: Count elements in the dictionary
The value of the response page will be "10"
| translate.asp |
| <%
SET MyDictionary=CreateObject("Scripting.Dictionary") MyDictionary.Add "one","uno"Response.Write(MyDictionary.Count) %> |