ªð¦^¦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

¦^´_ 11# GBKEE


    ·PÁ¶Wª©¤j¤j,§Ú¸Õ¸Õ¬Ý^_^
PKKO

TOP

¦^´_ 10# PKKO
Åܳq¤@¤U,¤@¦¸«Ø¥ß5­Ó¦r¨åª«¥ó¬Ý¬Ý
  1. Option Explicit
  2.   Sub main_flow()
  3.     Dim xd(0 To 4), i As Long, j As Long, Ok As Integer, E As Variant
  4.     For i = 0 To 4
  5.         Set xd(i) = CreateObject("SCRIPTING.DICTIONARY")
  6.         '1¸U­Ó¸¹½X¿é¤J5­Óª«¥ó¤º
  7.             For j = 1 To 10000
  8.                 xd(i)(j) = Empty
  9.             Next
  10.     Next
  11. Ok = 0
  12. Do While Ok < 5
  13.     'rng¬°¤@­Ó¤£Â_Åܰʪº2ºû°}¦C
  14.     '³oÃä¶}©l¤ñ¹ï©Ò¦³±ø¥ó,±N­«½Æªº¸ê®Æ²¾°£±¼
  15. fn:
  16.      If xd(Ok).Count < 9 Then Ok = Ok + 1
  17.     For i = 1 To UBound(Rng, 2)
  18.         For Each E In xd(Ok).KEYS
  19.                 If Rng(i, E) = True Then xd(Ok).Remove (E)
  20.                 If xd(Ok).Count < 9 Then GoTo fn
  21.         Next
  22.     Next
  23.     If xd(Ok).Count = 9 Then Call output(xd)
  24. Loop
  25. End Sub
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

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

¦^´_ 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

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

¥»©«³Ì«á¥Ñ 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

¦^´_ 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

¦^´_ 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

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

TOP

        ÀR«ä¦Û¦b : ¦Û¤v®`¦Û¤v¡A²ö¹L©ó¶ÃµoµÊ®ð¡C
ªð¦^¦Cªí ¤W¤@¥DÃD