Scripting Runtime Library(Dictionary)

Dictionary °³Ã¼¿¡ Å°-Ç׸ñ ½ÖÀ» Ãß°¡ÇÑ´Ù.

Àμö/ÆĶó¸ÞÅÍ
objectName : Dictionary
ÇʼöÀûÀÎ ¿ä¼ÒÀ̸ç, Ç×»ó Dictionary °³Ã¼ÀÇ À̸§ÀÌ´Ù.
key
ÇʼöÀûÀÎ ¿ä¼ÒÀ̸ç, Ãß°¡ÇÒ item°ú ¿¬°áµÈ keyÀÌ´Ù.
item
ÇʼöÀûÀÎ ¿ä¼ÒÀ̸ç, Ãß°¡ÇÒkey¿Í ¿¬°áµÈ itemÀÌ´Ù.
¼³¸í

key°¡ ÀÌ¹Ì Á¸ÀçÇÏ´Â °æ¿ì¿¡´Â ¿À·ù°¡ ¹ß»ýÇÑ´Ù.


°á°ú Ç¥½Ãâ
JScript Add ¸Þ¼­µå ¿¹Á¦
<SCRIPT language=JScript>
function AddTest(){
  var DicObj,str='';
  DicObj=new ActiveXObject('Scripting.Dictionary');
  DicObj.Add('a','»ç°ú');
  DicObj.Add('b','¹Ù³ª³ª');
  DicObj.Add('c','ü¸®');

  KeyArr=new VBArray(DicObj.Keys()).toArray(); // Key Ç׸ñÀ» °¡Á®¿Â´Ù.
  DicArr=new VBArray(DicObj.Items()).toArray(); // Ç׸ñÀ» °¡Á®¿Â´Ù.
  for (numb in DicArr){ // dictionary¸¦ ¹Ýº¹ÇÑ´Ù.
    str+=numb+') "'+KeyArr[numb]+'"='+DicArr[numb]+'<BR>';
  }
  return(str);
}
</SCRIPT>

<DIV id=showjs class=show alt="°á°ú">°á°ú Ç¥½Ãâ</DIV>
<DIV class=show onClick="showjs.innerHTML=AddTest()">
  <SPAN class=ie>JScript</SPAN> <SPAN class=method>Add</SPAN> ¸Þ¼­µå ¿¹Á¦</DIV>
°á°ú Ç¥½Ãâ
VBScript Add ¸Þ¼­µå ¿¹Á¦
<SCRIPT language=VBScript>
Function AddTestvb
  Dim DicObj,DicArr,i,str ' º¯¼ö¸¦ ¸¸µç´Ù.
  Set DicObj=CreateObject("Scripting.Dictionary")
  DicObj.Add "a","»ç°ú" ' Å°¿Í Ç׸ñÀ» Ãß°¡ÇÑ´Ù.
  DicObj.Add "b","¹Ù³ª³ª"
  DicObj.Add "c","ü¸®"

  DicArr=DicObj.Keys ' Å°¸¦ °¡Á®¿Â´Ù.
  For i=0 To DicObj.Count-1 ' dictionary¸¦ ¹Ýº¹ÇÑ´Ù.
    str=str&"'"&DicArr(i)&"' : "&DicObj.Item(DicArr(i))&"<BR>" ' °á°ú¸¦ ¹ÝȯÇÑ´Ù.
  Next
  AddTestvb=str
End Function
</SCRIPT>

<DIV id=showvb class=show alt="°á°ú">°á°ú Ç¥½Ãâ</DIV>
<DIV class=show onClick="showvb.innerHTML=AddTestvb()">
  <SPAN class=ie>VBScript</SPAN> <SPAN class=method>Add</SPAN> ¸Þ¼­µå ¿¹Á¦</DIV>