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

[µo°Ý] ¦p¦ó²¾°£°}¦C¤º­«½Æªº³¡¤À(STRING)

[µo°Ý] ¦p¦ó²¾°£°}¦C¤º­«½Æªº³¡¤À(STRING)

MyArray() ="XX","aa","ab",XX","ab"
¦p¦ó¥i¨ú±o"XX","aa","ab"ªº­È©O(¤£­«½Æ)
PKKO

¦^´_ 1# PKKO

¸Õ¸Õ¬Ý
  1. Option Explicit
  2. Sub EX()
  3.     Dim AR, D As Object, E As Variant
  4.     AR = Array("XX", "aa", "ab", "ab", "ab", "XX", "ab")
  5.     Set D = CreateObject("SCRIPTING.DICTIONARY")  '¦r¨åª«¥ó
  6.     For Each E In AR
  7.         D(E) = ""
  8.     Next
  9.     AR = D.KEYS
  10.     MsgBox Join(AR, vbLf)
  11.     Stop
  12.     MsgBox Join(D.KEYS, vbLf)  '¦P¤W
  13. End Sub
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

¦^´_ 2# GBKEE

ª©¤j¤Ó±j¤j¤F,§¹¥þ¥i¥H¨Ï¥Î
¥i§_½Ð±Ð¤@¤U
For Each E In AR

        D(E) = ""

    Next

¬°¦ó­nÅý¨C¤@­Ó°}¦C¤ºªºDª«¥ó³£Åܦ¨""
Keys ¤èªk Returns an array containing all existing keys in a Dictionary object.
D.KEYS
¹ê»Ú¤W³o­Óªº·N«ä¤£¬O«ÜÀ´!
PKKO

TOP

¦^´_ 3# PKKO
¬°¦ó­nÅý¨C¤@­Ó°}¦C¤ºªºDª«¥ó³£Åܦ¨""
¦]¬°¥Î¤£¨ì°Ú
  1. Option Explicit
  2. Sub EX()
  3.     Dim d                   '«Ø¥ß¤@­ÓÅܼÆ
  4.     Set d = CreateObject("Scripting.Dictionary")
  5.     '***********************
  6.     d.Add "a", "Athens"     '¥[¤J¤@¨ÇÃöÁä¦r©M¶µ¥Ø
  7.     d.Add "b", "Belgrade"
  8.     d.Add "c", "Cairo"
  9.     MsgBox Join(d.items, vbLf) '¶µ¥Ø
  10.     MsgBox Join(d.keys, vbLf)  'ÃöÁä¦r
  11. End Sub
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

¦^´_ 4# GBKEE

·PÁª©¤j,¤w¸g¤F¸Ñ,¶]°j°éªº¥Î³~¬OÅýDª«¥ó·|¦b°}¦C¤§¤º
¦b°j°é¤ºÅý­È¬°"" ¹ê»Ú¤W¥u¬Oitems·|Åܦ¨""
¤£¼vÅTÃöÁä¦r,¦]¦¹KEYS¥i¥H¥¿±`¿é¥X,·P®¦!!
PKKO

TOP

¦^´_ 2# GBKEE

2014¦~ªº¤å³¹¨ì¤F2020ÁÙ¬O«D±`¹ê¥Î

³o¤èªkÀ°§Ú¸Ñ¨M°}¦C²¾°£­«½Æªº°ÝÃD

¹ï©ó¦r¨åªº¥Îªk¤£¬O«Ü²M·¡
¤@ª½¤£À´¬°¤°»ò
  1. For Each E In AR
  2.     D(E) = ""
  3. Next
  4. AR = D.KEYS
½Æ»s¥N½X
¥i¥H¹F¨ì²¾°£­«½Æªº®ÄªG

§Ú¬Ý¤F¤U¤èªº¦^ÂÐÁÙ¬O¤£²M·¡@@

¦A½Ðª©¥D«ü±Ð

ÁÂÁÂ
¥Î¥\¨ì¥@¬É¥½¤é¨º¤@¤Ñ¡ã¡ã¡ã

TOP

¦^´_ 1# PKKO

´£¨Ñ¤@­Ó¤£¨Ï¥Î¦r¨åª«¥óªº¼gªk

Arr ³B²z¹L«á ±o¨ì¤@­Ó ¤£­«½Æªº Brr °}¦C
  1. Sub test()
  2. Arr = Array("XX", "aa", "ab", "ab", "ab", "XX", "ab")
  3. T$ = ""
  4. For Each Item In Arr
  5.   If InStr(T$, Item) = 0 Then T = Trim(T & " " & Item)
  6. Next
  7. Brr = Split(T, " ")
  8. End Sub
½Æ»s¥N½X
µ{¦¡¬O¨Ì»Ý¨D¼gªº¡A»Ý¨Dªí¹F¤£²M·¡
©ÎªÌ¨S¦³¤W¶Çªþ¥ó¡A·R²ö¯à§U

TOP

¦^´_ 6# li_hsien

­ì¥ý
For Each E In AR
    D(E) = ""
Next
AR = D.KEYS


§ï¬°¡A±N E §ï¬° Key¡A¬O§_¤ñ¸û¦³·Pı
For Each Key In AR
    D(Key) = ""
Next
AR = D.KEYS


¦]¬°¦r¨å°}¦C D(Key)¸ÌªºKey¤£·|¦³­«½Æ­È¡A
·í Key ±q AR °}¦C¨ú¥X¦³­«½Æ­È®É¡A·|¥H«e¤@­Ó¬Û¦PKey­Èªº D(Key) ¬°¦ì¸m¡C


D(Key) = ""¡A«á­±½á­È¬O¬Æ»ò¤£­«­n¡A¦]¬°«á­±¥Î D.KEYS ¨ú¥X¤£­«½Æ­È¡C


~ ­Ó¤H¸ÑŪ¡A¨Ñ§A°Ñ¦Ò ~
{...} ªí¥Ü»Ý­n¥Î CTRL+SHIFT+ENTER ¤TÁä¿é¤J¤½¦¡

TOP

¥»©«³Ì«á¥Ñ ­ã´£³¡ªL ©ó 2020-5-18 11:46 ½s¿è

¦^´_ 6# li_hsien

D(Key) = Item
¥i±NKey¤ñ³ë¬°¤£¦Pªº¤H, ¦Ó¨C¤@­Ó¤H­I­Ó¥]¥], ³o¥]¥]¥i¸Ë¥ô¦óªF¦è(Item),
Key­È¬O°ß¤@ªº(¨C­Ó¤H¦b¥@¤W³£¬O°ß¤@ªº), ¦ÓItem¥i½á¤_¨ä¬ÛÃöÁpªº¤º®e, ©Î¬°ªÅ(¥]¥]¤£¸ËªF¦è),
¦]¬°¥Øªº¥u¬O­n¨ú±o¤£­«ÂЭÈ(§YKey­È), ©Ò¥H¥ÎªÅ¦r²Å""¬°Item,
__¥ç§Y¨C¤@­Ó¤H³£´®­ÓªÅ¥]¥], »{¤H¤£»{¥]
D(Key)=""
D(Key)=1
D(Key)="A"
³£¥i¥H±o¨ì¬Û¦P®ÄªG, 1¤ÎA¬OÀH·Nµ¹ªº,¦ý¦b³o¸Ì²@µL·N¸q~~


================================

TOP

¦^´_ 7# n7822123


If InStr(" " & T$ & " "," " & Item & " ") = 0 Then T = Trim(T & " " & Item)
¥Î¤À¹j²Å¸¹±N¦r¦ê¥]ÂЦA¤ñ¹ï, ÁקK¿ù§P,
¨Ò¦p:"AA", "AAA", "±i¤T", "±i¤T­¦" ·|¦³©Ò²V²c~~

TOP

        ÀR«ä¦Û¦b : ­n¥Î¤ß¡A¤£­n¾Þ¤ß¡B·Ð¤ß¡C
ªð¦^¦Cªí ¤W¤@¥DÃD