ªð¦^¦Cªí ¤W¤@¥DÃD µo©«

[µo°Ý] ¦³¨S¦³¬Æ»ò¤è¦¡¥i¥H½Æ»sª«¥ó?CreateObject("SCRIPTING.DICTIONARY")

[µo°Ý] ¦³¨S¦³¬Æ»ò¤è¦¡¥i¥H½Æ»sª«¥ó?CreateObject("SCRIPTING.DICTIONARY")

¨Ò¦pCreateObject("SCRIPTING.DICTIONARY") ª«¥ó
¤w¸g¿é¤J¤F¤@¸U­Ókey­È

¦ý§Ú¦b¹ê»ÚÀ³¥Îªº®É­Ô¥²¶·­n¥Îremove¥\¯à
¾É­P¦A¦¸¤ñ¹ïªº®É­Ô
§Ú»Ý­n­«·sremoveall
µM«á¦A¿é¤J¤@¸Uµ§key­È
¤~¥i¥H­«·s°õ¦æ

¦pªG¥i¥H¹³°}¦C¤@¼Ë½Æ»sª½±µa=b(µ{¦¡°õ¦æ³t«×´N§Ö¤F)

§Ú¸Õ¹LSet D = CreateObject("SCRIPTING.DICTIONARY")
µM«áa=D µ²ªG¥¢±Ñ
¤]¸Õ¹LSet a =D
µ²ªGa´N¯uªºµ¥©óD,D¤]³Qremove±¼¤F

¨D¤j¤j­Ì¦³¤èªk¶Ü?
¦¹¥Øªº¬O¬°¤F°õ¦æ³t«×§ó§Ö
PKKO

¦^´_ 1# PKKO


    ¤£¥i¥H¥Î¦h­Ó¦r¨å¶Ü?

TOP

¦^´_ 2# ikboy


    ¥i¥H¥Î¦h­Ó¦r¨å
¦ý§Úªº»Ý¨D¬O¦]¬°,°²³]­n±N1~1¸U¿é¤J¨ì¦r¨å¤º
remove¤§«á´N¨S¦³§¹¾ãªº¦r¨å
¤S­n¦A¿é¤J¤@¦¸

¦A¿é¤J¤@¦¸¸ò¿é¤J¦h­Ó¦r¨å¬O¤@¼Ëªº·N«ä

·íµ{¦¡»Ý­n°õ¦æ¤W¦Ê¸U¦¸ªº®É­Ô
¥ú¬O±N1~1¸U¿é¤J¦Üª«¥ó,´Nªá¤F«Ü¦h®É¶¡¤F
­Y¦³¤è¦¡¥i¥H½Æ»s´N§¹¬ü¤F!
PKKO

TOP

²Ä¤@­Ó¦r¨å, ¤£­nªº¥h°£«á, ·íµM­n±qÀY¨Ó¹L,
¤Ï¤§, ±N­nªº¥á¨ì°}¦C, ©Î¥á¨ì¥t¤@¦r¨å, ²Ä¤@­ÓÁÙ¬O¥»¨Ó­±¥Ø!

TOP

¦^´_ 1# PKKO


   
§Ú¸Õ¹LSet D = CreateObject("SCRIPTING.DICTIONARY")
µM«áa=D µ²ªG¥¢±Ñ
¤]¸Õ¹LSet a =D
µ²ªGa´N¯uªºµ¥©óD,D¤]³Qremove±¼¤F

¤£À´§Aªº»¡ªk,¥ipoµ{¦¡½X ¬Ý¬Ý
  1. Option Explicit
  2. Sub EX()
  3.     Dim D As Object, i As Integer, a
  4.     Set D = CreateObject("SCRIPTING.DICTIONARY")
  5.     For i = 1 To 50
  6.         D(i) = i * 2
  7.     Next
  8.     Stop
  9.     MsgBox D.Count
  10.     a = D(5)
  11.     MsgBox a
  12.     Stop
  13.     MsgBox D.Count  '¨S³QRemove±¼
  14. End Sub
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

¦^´_ 5# GBKEE
ª©¤jªºª¬ªp¥i¯à¦p¤U¡G
Sub test()
    Dim D As Object, COPYD As Object, i As Integer
    Set D = CreateObject("SCRIPTING.DICTIONARY")
    Set COPYD = CreateObject("SCRIPTING.DICTIONARY")
    For i = 1 To 50
        D(i) = i * 2
    Next
    MsgBox "D­ì©l¼Æ¶q¡G" & D.Count
   
    Set COPYD = D
    MsgBox "COPYD­ì©l¼Æ¶q¡G" & COPYD.Count
   
    D.Remove (5) 'Remove±¼D.Keys¤º¤@­Ó 5 ªº­È¤§«á
    MsgBox "²¾°£D.Keys¤ºªº¤@­Ó­È«á....."
   
    MsgBox "D¥Ø«e¼Æ¶q¡G" & D.Count
    MsgBox "¨S¦³°Ê¨ìCOPYDªºª¬ªp¤U¥Ø«e¼Æ¶q¤]¬O¡G" & COPYD.Count
End Sub
«Øijª©¤j¬O§_¯à©ó¾Þ§@«e±N¦r¨åÀÉDÂন¤Gºû°}¦C«Ý¥Î¡A·í¦r¨åÀÉD¾Þ§@¨ÃRemoveAll¤§«á¡A¦A±q¤Gºû°}¦C¸ê®ÆÁýµ¹¦r¨åÀÉD¡A¥u¬O³oºØ¤è¦¡¤£ª¾¬O§_¯à¹F¦¨³t«×ªº­n¨D¡C

TOP

¥»©«³Ì«á¥Ñ PKKO ©ó 2016-8-10 12:36 ½s¿è

¦^´_ 5# GBKEE

©êºp,¤p§Ì¨S¦³»¡©ú²M·¡¾É­P¦U¦ìªº§xÂZ,¤p§Ìªº°ÝÃD¦p¤U
  1. Sub main_flow()
  2. OK = 0
  3. Do While OK < 5
  4.     '¨C¦¸­«·s¶}©lªº®É­Ô,³£»Ý­n±N1¸U­Ó¸¹½X¿é¤J¦Üª«¥ó¤º
  5. fn: Set XD = CreateObject("SCRIPTING.DICTIONARY")
  6.     For J = 1 To 10000
  7.         XD(J) = Empty
  8.     Next
  9.     'rng¬°¤@­Ó¤£Â_Åܰʪº2ºû°}¦C
  10.     '³oÃä¶}©l¤ñ¹ï©Ò¦³±ø¥ó,±N­«½Æªº¸ê®Æ²¾°£±¼
  11.     For I = 1 To UBound(rng, 2)
  12.         For Each E In XD.KEYS
  13.                 If rng(i, E) = True Then XD.Remove (E)
  14.                 if xd.count<9 then goto fn
  15.         Next
  16.     Next
  17.     if xd.count=9 then call output(xd)
  18. Loop
  19. End Sub
½Æ»s¥N½X
¥Øªº¬O­n§ä¥X³Ñ¾l¨S¥X²{ªº¼Æ¦r,­è¦n=9­Ó,¦ý¦¹°Ê§@«o­n¨C¦¸³£­n­«·s¿é¤J¤@¦¸¦r¨åª«¥ó¤@¸U­Ó¼Æ¦r
­Y¤£¥Î²¾°£ªº¤è¦¡,¶]©T©wªº°j°é¤Ï¦Ó·|ªá§ó¦hªº®É¶¡,¦]¬°¦³¥i¯à°õ¦æ¤F¤@¤d¦h¦¸¤§«á,XD.count¥u³Ñ¤U¤Q´X­Ó¼Æ¦r,¨S¥²­n¶]¥þ³¡ªº°j°é
PKKO

TOP

Arr=§¹¾ã¸ê®Æ
Brr=¤ñ¹ï¸ê®Æ
Crr=¤ñ¹ï¸ê®Æ

For Each B In Brr:  Dic1(B)="":  Next
For Each C In Crr:  Dic2(C)="":  Next

For Each A In Arr
    If Not Dic1.Exists(A) Then Dic3(A)=""
    If Not Dic2.Exists(A) Then Dic4(A)=""
Next

Dic3 ¤Î Dic4 ´N¬O­Ó§O±Æ°£«áªº¸ê®Æ,
¥þ³¡¤@­Ó°j°é§¹¦¨!

TOP

¦^´_ 8# ­ã´£³¡ªL


    ­ã¤j±z¦n
¦]¸Ó¬O§Ú»¡©ú¤£²M·¡
¨ä¹ê§Úªº»Ý¨D¬O
§ä¥X¤­²Õrng°}¦C(1 to 200,1 to 10000)ªº°}¦C
¸Ì­±­è¦n¥u¦³9991­Ó¼Æ¦r,³Ñ¤U9­Ó¨S¦³¼Æ¦r¨S¦³¥X²{¹L
¦ý­Y­n±½¹Lrng°}¦Cªº¨C¤@­Ó¸ê®Æ,´N¤Ó¯Ó®É

©Ò¥H§Ú¤~·|­n¥Îremoveªº¥\¯à,²Å¦X´N¤£¦b¤ñ¹ï
¦Órng°}¦C¬O¨Æ«e´N¤w¸g¾ã²z¦n¤F,¥L·|±N¼Æ¦rrng(1,1)=1 ,  rng(1,1000)=1000,rng(1,2000)=2000
rng(x,y)=>y=¦h¤Ö´N=¦h¤Ö
PKKO

TOP

¦^´_ 8# ­ã´£³¡ªL


    ¦]¬°¤p§Ì·MÄøªº»{¬°«á­±ªº¬yµ{¦]¸ÓµLªk§ó¥[§Ö³t¤F,©Ò¥H¤~¨S¦³»¡©ú§¹¾ãªº¬yµ{,¥u¦³°Ý«eºÝªº¦r¨å³¡¤À
²`·P©êºp

¦]¬°«á­±ªº¬yµ{,¥L¤@¦ý³Ñ¾l¨S¥X²{ªº¼Æ¦r¤p©ó9­Ó¼Æ¦r,§Ú´Nª½±µ¸õ¹L¤F
©Ò¥H¦³®É­Ô¤@­Ó¤Gºû°}¦C¥u¶]¨â¤T¦C´N¤w¸g¸õ¹L¤F
PKKO

TOP

        ÀR«ä¦Û¦b : ¨ü¤HÂI¤ô¤§®¦¡A¶··í´é¬u¥H³ø¡C
ªð¦^¦Cªí ¤W¤@¥DÃD