Scripting Runtime Library(Dictionary)
Dictionary °³Ã¼¿¡¼ Å°-Ç׸ñ ½ÖÀ» Çϳª Á¦°ÅÇÑ´Ù.
¹Ýȯ°ªÀº ¾ø´Ù.
Dictionary °³Ã¼¿¡¼ Å°-Ç׸ñ ½ÖÀ» Çϳª Á¦°ÅÇÑ´Ù.
ÁöÁ¤ÇÑ Å°-Ç׸ñ ½ÖÀÌ ¾øÀ¸¸é ¿À·ù°¡ ¹ß»ýÇÑ´Ù.
<SCRIPT language=JScript> function RemoveTest(key){ var KeyArr,DicArr,dicObj,numb,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>'; } str+='dicObj.Count='+dicObj.Count+'<BR><BR>'; dicObj.Remove(key); // µÎ ¹ø° ½ÖÀ» Á¦°ÅÇÑ´Ù. str+='dicObj.Remove(key)<BR>'; 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>'; } str+='dicObj.Count='+dicObj.Count; return(str); } </SCRIPT> <DIV id=showjs class=show alt="°á°ú">°á°ú Ç¥½Ãâ</DIV> <DIV class=show onClick="id=showjs.innerHTML=RemoveTest('b')"> <SPAN class=ie>JScript</SPAN> <SPAN class=method>Remove</SPAN> ¸Þ¼µå ¿¹Á¦</DIV>
<SCRIPT language=VBScript> Function RemoveTestvb(key) Dim KeyArr,DicArr,dicObj,numb ' º¯¼ö¸¦ ¸¸µç´Ù. str="" Set dicObj=CreateObject("Scripting.Dictionary") dicObj.Add "a","»ç°ú" ' Å°¿Í Ç׸ñÀ» Ãß°¡ÇÑ´Ù. dicObj.Add "b","¹Ù³ª³ª" dicObj.Add "c","ü¸®" KeyArr=DicObj.Keys ' Å°¸¦ °¡Á®¿Â´Ù. DicArr=DicObj.Items ' Ç׸ñÀ» °¡Á®¿Â´Ù. For numb=0 To DicObj.Count-1 ' dictionary¸¦ ¹Ýº¹ÇÑ´Ù. str=str&"'"&KeyArr(numb)&"' : "&DicArr(numb)&"<BR>" ' °á°ú¸¦ ¹ÝȯÇÑ´Ù. Next str=str&"dicObj.Count="&dicObj.Count&"<BR><BR>" str=str&"dicObj.Remove(key)<BR>" dicObj.Remove(key) ' µÎ ¹ø° ½ÖÀ» Á¦°ÅÇÑ´Ù. DicArr=DicObj.Keys ' Å°¸¦ °¡Á®¿Â´Ù. For numb=0 To DicObj.Count-1 ' dictionary¸¦ ¹Ýº¹ÇÑ´Ù. str=str&"'"&DicArr(numb)&"' : "&DicObj.Item(DicArr(numb))&"<BR>" ' °á°ú¸¦ ¹ÝȯÇÑ´Ù. Next str=str&"dicObj.Count="&dicObj.Count RemoveTestvb=str End Function </SCRIPT> <DIV id=showvb class=show alt="°á°ú">°á°ú Ç¥½Ãâ</DIV> <DIV class=show onClick="showvb.innerHTML=RemoveTestvb('b')"> <SPAN class=ie>VBScript</SPAN> <SPAN class=method>Remove</SPAN> ¸Þ¼µå ¿¹Á¦</DIV>