Monday, October 16, 2017

Dictionaries

'on error resume next
Set dict = createobject("Scripting.Dictionary")'-- creating the dictionary object
dict.Add "sudheer","USA"'---adding via Key and Value to Dictionary
dict.Add "sunil","Australia"
dict.Add "suresh","India"

print dict.Count    '--- the total count of dictionaty


print dict.Exists ("sudheera")'---key is existing or not

print dict.Item("sunil")'-----'it will print australia

temp= dict.Keys'----it saves all dictionary Keys to array

For Iterator = 0 To ubound(temp) Step 1
    print temp(i)
Next

dict.Key("suresh")="indiahh"'---changing the values of keys
print dict.Exists("indiahh")'--cjecking whether ut is exists or not
print dict.Exists("suresh")

temp=dict.Keys'---adding all keys to an array


For j = 0 To ubound(temp) Step 1
    print "Key is- "&temp(j)& ".Values is-" & dict.Item(temp(j))
Next



output

3
False
Australia
sudheer
sudheer
sudheer
True
False
Key is- sudheer.Values is-USA
Key is- sunil.Values is-Australia
Key is- indiahh.Values is-India
 

No comments:

Post a Comment

Description Programming

'==Descriptive Programming language 'creating the common browser and page object  Set  myPage= browser( "creationtime:=0...