ASP-Dictionary对象-基础用法

1、存在

dim d
set d=Server.CreateObject("Scripting.Dictionary")
d.Add "c", "China"
d.Add "i", "Italy"
if d.Exists("c")= true then
Response.Write("键存在。")
else
Response.Write("键不存在。")
end if
set d=nothing

2、遍历值

a=d.Items
for i = 0 To d.Count -1
s = s & a(i)
next
Response.Write(s)

3、遍历主键

a=d.Keys
for i = 0 To d.Count -1
s = s & a(i)
next
Response.Write(s)

4、返回值

d.Add "c", "China"
d.Add "i", "Italy"
Response.Write("项目 i 的值是:" & d.item("i"))

5、修改主键

d.Add "c", "China"
d.Add "i", "Italy"
d.Key("i") = "it"
Response.Write("键 i 已设置为 it,其值是:" & d.Item("it"))

6、返回数量

d.Count

7、删除

DictionaryObject.Remove(key)
DictionaryObject.RemoveAll

10 条评论

  1. reviewer
    minecraft
    2018年9月10日

    An interesting discussion is worth comment. I
    do think that you need to publish more about this subject, it might not be a taboo matter but generally people don't talk about
    such subjects. To the next! Best wishes!!

    回复
  2. reviewer
    minecraft
    2018年9月10日

    Very good write-up. I absolutely appreciate this site.

    Thanks!

    回复
  3. reviewer
    minecraft
    2018年9月9日

    Wow, superb blog layout! How long have you been blogging for?
    you made blogging look easy. The overall look of your
    site is fantastic, let alone the content!

    回复
  4. reviewer
    minecraft
    2018年9月8日

    I believe this is one of the such a lot significant info for me.
    And i'm satisfied studying your article. However should
    statement on few common things, The site style is wonderful, the articles is in reality great : D.

    Good job, cheers

    回复
  5. reviewer
    minecraft
    2018年9月8日

    Hi there! I simply wish to give you a big thumbs up for the
    excellent info you have here on this post. I am coming back
    to your website for more soon.

    回复
  6. reviewer
    minecraft
    2018年9月7日

    Hello, i read your blog occasionally and i own a similar one and i was just
    wondering if you get a lot of spam feedback? If so how do you protect against it, any plugin or anything you can recommend?
    I get so much lately it's driving me crazy so any
    help is very much appreciated.

    回复
  7. reviewer
    minecraft
    2018年9月6日

    each time i used to read smaller content which as well clear their motive, and that is also happening with this article which I am reading here.

    回复
  8. reviewer
    More Hints
    2017年8月22日

    It's very effortless to find out any topic on web as compared to
    books, as I found this paragraph at this web site.

    回复
  9. reviewer
    try What he says
    2017年8月21日

    Hi, I would like to subscribe for this blog to take newest updates, therefore where can i
    do it please help.

    回复
  10. reviewer
    Read This method
    2017年8月19日

    Hey I am so glad I found your blog page, I really found you by mistake, while I was looking on Askjeeve for something else, Anyways I am here now and
    would just like to say kudos for a remarkable post and a all round interesting blog
    (I also love the theme/design), I don't have time to
    browse it all at the minute but I have saved it and
    also included your RSS feeds, so when I have time I will be back
    to read a great deal more, Please do keep up the excellent
    job.

    回复

发表评论

您的电子邮箱地址不会被公开。