JScript
Scripting Runtime Library(Dictinary)
Dictionary °³Ã¼ÀÇ ±âÁ¸ Å°¸¦ ¸ðµÎ Æ÷ÇÔÇÑ ¹è¿À» ¹ÝȯÇÑ´Ù.
object´Â Ç×»ó Dictionary °³Ã¼ÀÇ À̸§ÀÌ´Ù.
ÆĶó¸ÞÅÍ´Â ¾ø´Ù.
¹Ýȯ°ª oCollÀº Dictionary °³Ã¼ÀÇ ±âÁ¸ Å°¸¦ ¸ðµÎ Æ÷ÇÔÇÑ ¹è¿À» ¹ÝȯÇÑ´Ù.
<SCRIPT language=JScript> function KeysTest(){ var DicKeyArr,DicArr,dicObj,i,str=''; // º¯¼ö¸¦ ¸¸µç´Ù. dicObj=new ActiveXObject('Scripting.Dictionary'); dicObj.Add('a','»ç°ú'); // Å°¿Í Ç׸ñÀ» Ãß°¡ÇÑ´Ù. dicObj.Add('b','¹Ù³ª³ª'); dicObj.Add('c','ü¸®'); DicKeyArr=new VBArray(dicObj.Keys()).toArray(); // Å°¸¦ °¡Á®¿Â´Ù. DicArr=new VBArray(dicObj.Items()).toArray(); // Ç׸ñÀ» °¡Á®¿Â´Ù. for (i in DicArr){ // dictionary¸¦ ¹Ýº¹ÇÑ´Ù. str+=i+') '+DicKeyArr[i]+' : '+DicArr[i]+'<BR>'; } str+='<BR>dicObj.Count='+dicObj.Count; return(str); // °á°ú¸¦ ¹ÝȯÇÑ´Ù. } </SCRIPT> <DIV id=showjs class=show alt="°á°ú">°á°ú Ç¥½Ãâ</DIV> <DIV class=show onClick="id=showjs.innerHTML=KeysTest()"> <SPAN class=ie>JScript</SPAN> <SPAN class=method>Keys</SPAN> ¸Þ¼µå ¿¹Á¦</DIV>
<SCRIPT language=VBScript> Function KeysTestvb Dim DicArr,dicObj,i ' º¯¼ö¸¦ ¸¸µç´Ù. str="" Set dicObj=CreateObject("Scripting.Dictionary") dicObj.Add "a","»ç°ú" ' Å°¿Í Ç׸ñÀ» Ãß°¡ÇÑ´Ù. dicObj.Add "b","¹Ù³ª³ª" dicObj.Add "c","ü¸®" DicKeyArr=dicObj.Keys ' Å°¸¦ °¡Á®¿Â´Ù. DicArr=dicObj.Items ' Ç׸ñÀ» °¡Á®¿Â´Ù. For i=0 To dicObj.Count-1 ' array¸¦ ¹Ýº¹ÇÑ´Ù. str=str&i&") "&DicKeyArr(i)&" : "&DicArr(i)&"<BR>" ' ¹Ýȯ ¹®ÀÚ¿À» ¸¸µç´Ù. Next str=str&"<BR>dicObj.Count="&dicObj.Count KeysTestvb=str End Function </SCRIPT> <DIV id=showvb class=show alt="°á°ú">°á°ú Ç¥½Ãâ</DIV> <DIV class=show onClick="showvb.innerHTML=KeysTestvb()"> <SPAN class=ie>VBScript</SPAN> <SPAN class=method>Keys</SPAN> ¸Þ¼µå ¿¹Á¦</DIV>