¹®ÀÚ¿­ µ¥ÀÌÅÍ Ã¤¿öÁø´Ù ½ºÅ©¸³ÆÃ »çÀü Á¤·Ä

±â¼ú ÀÚ·á: 246067 - ÀÌ ¹®¼­°¡ Àû¿ëµÇ´Â Á¦Ç° º¸±â.
¸ðµÎ È®´ë | ¸ðµÎ Ãà¼Ò

¿ä¾à

½ºÅ©¸³ÆÃ Dictionary °³Ã¼¸¦ °íÀ¯ Ű ¹× Ç׸ñ µ¥ÀÌÅͰ¡ ±¸¼ºµÈ ¹è¿­ Á¤º¸°¡ ÀúÀåµÇ´Â PERL °áÇÕ ¹è¿­ÀÇ °Í°ú °°½À´Ï´Ù. Á¤·ÄµÇÁö ¾ÊÀº ÀÌ Á¤º¸°¡ ÀúÀåµÇ¾î ÀÖÀ¸¹Ç·Î ÅëÇØ ¹è¿­ÀÇ ¿­°Å ÀúÀåµÇ¾î ÀÖ´ø ÁÖ¹® Á¤º¸¸¦ ¹ÝȯÇÕ´Ï´Ù. ÀÌ ¹®¼­ÀÇ ¸ñÀûÀº Ű ¶Ç´Â Ç׸ñÀÇ ¹®ÀÚ¿­ µ¥ÀÌÅͷΠä¿î »çÀü °³Ã¼ÀÇ ³»¿ëÀ» Á¤·ÄÇÕ´Ï´Ù SortDictionary() ÇÔ¼ö¸¦ Á¤ÀÇÇØ¾ß ÇÕ´Ï´Ù.

Ãß°¡ Á¤º¸

´ÙÀ½ ÄÚµå ¿¹Á¦¿¡¼­´Â dictKey ¹× dictItem, SortDictionary() ÇÔ¼ö¿¡ ÀÇÇØ »ç¿ëµÇ´Â »ó¼ö¸¦ Á¤ÀÇÇÕ´Ï´Ù. SortDictionary() ÇÔ¼ö´Â µÎ °³ÀÇ ¸Å°³ º¯¼ö¸¦ ½ºÅ©¸³ÆÃ »çÀü ¹× »çÀü Ű ¶Ç´Â Ç׸ñÀ» Á¤·ÄÇÒ °ÍÀÎÁö °áÁ¤ÇÏ´Â µ¥ »ó¼ö Áß Çϳª¸¦ ÀÌÀü¿¡ ¸¸µç °³Ã¼¸¦ »ç¿ëÇÕ´Ï´Ù.

Const dictKey  = 1
Const dictItem = 2

Function SortDictionary(objDict,intSort)
  ' declare our variables
  Dim strDict()
  Dim objKey
  Dim strKey,strItem
  Dim X,Y,Z

  ' get the dictionary count
  Z = objDict.Count

  ' we need more than one item to warrant sorting
  If Z > 1 Then
    ' create an array to store dictionary information
    ReDim strDict(Z,2)
    X = 0
    ' populate the string array
    For Each objKey In objDict
        strDict(X,dictKey)  = CStr(objKey)
        strDict(X,dictItem) = CStr(objDict(objKey))
        X = X + 1
    Next

    ' perform a a shell sort of the string array
    For X = 0 to (Z - 2)
      For Y = X to (Z - 1)
        If StrComp(strDict(X,intSort),strDict(Y,intSort),vbTextCompare) > 0 Then
            strKey  = strDict(X,dictKey)
            strItem = strDict(X,dictItem)
            strDict(X,dictKey)  = strDict(Y,dictKey)
            strDict(X,dictItem) = strDict(Y,dictItem)
            strDict(Y,dictKey)  = strKey
            strDict(Y,dictItem) = strItem
        End If
      Next
    Next

    ' erase the contents of the dictionary object
    objDict.RemoveAll

    ' repopulate the dictionary with the sorted information
    For X = 0 to (Z - 1)
      objDict.Add strDict(X,dictKey), strDict(X,dictItem)
    Next

  End If

End Function
				

A ¿¹Á¦ ÀÛ¾÷

´ÙÀ½Àº À§ÀÇ ±â´ÉÀ» »ç¿ëÇÏ¸é »ç¿ëÇÕ´Ï´Ù.

Âü°í: ÀÌ ¿¹Á¦¿¡¼­´Â ½ÇÁ¦ Á¤·Ä ÇÔ¼ö¿¡¼­ ¸ðµç ¸Þ¸ð°¡ Á¦°ÅµÇ¾ú½À´Ï´Ù.

´ÙÀ½ ASP Äڵ带 º¹»çÇÑ ´ÙÀ½ Àû¾îµµ ¾×¼¼½º ÇÔ²² Sortdemo.asp °°ÀÌ Æú´õÀÇ Æú´õ ÀúÀå ½ºÅ©¸³Æ®:
<%@LANGUAGE="VBSCRIPT"%>
<% Option Explicit %>
<html>
<head><title>Dictionary Sorting</title></head>
<body>
<%

  Dim d, i

  Const dictKey  = 1
  Const dictItem = 2

  Set d = Server.CreateObject("Scripting.Dictionary")

  d.Add "3", "Delta"
  d.Add "1", "Foxtrot"
  d.Add "4", "Bravo"
  d.Add "2", "Echo"
  d.Add "6", "Alpha"
  d.Add "5", "Charlie"

  Response.Write "<p>Before Sorting:<br>"
  For Each i In d
    Response.Write i & "=" & d(i) & "<br>"
  Next

  Response.Write "<p>By Key:<br>"
  SortDictionary d,dictKey
  For Each i In d
    Response.Write i & "=" & d(i) & "<br>"
  Next

  Response.Write "<p>By Item:<br>"
  SortDictionary d,dictItem
  For Each i In d
    Response.Write d(i) & "=" & i & "<br>"
  Next
%>
</body>
</html>
<%
  Function SortDictionary(objDict,intSort)
    Dim strDict()
    Dim objKey
    Dim strKey,strItem
    Dim X,Y,Z
    Z = objDict.Count
    If Z > 1 Then
      ReDim strDict(Z,2)
      X = 0
      For Each objKey In objDict
          strDict(X,dictKey)  = CStr(objKey)
          strDict(X,dictItem) = CStr(objDict(objKey))
          X = X + 1
      Next
      For X = 0 to (Z - 2)
        For Y = X to (Z - 1)
          If StrComp(strDict(X,intSort),strDict(Y,intSort),vbTextCompare) > 0 Then
              strKey  = strDict(X,dictKey)
              strItem = strDict(X,dictItem)
              strDict(X,dictKey)  = strDict(Y,dictKey)
              strDict(X,dictItem) = strDict(Y,dictItem)
              strDict(Y,dictKey)  = strKey
              strDict(Y,dictItem) = strItem
          End If
        Next
      Next
      objDict.RemoveAll
      For X = 0 to (Z - 1)
        objDict.Add strDict(X,dictKey), strDict(X,dictItem)
      Next
    End If
  End Function
%>
				
Ž»öÇÒ ¶§ ´ÙÀ½°ú °°Àº Ãâ·ÂÀÌ Ç¥½ÃµË´Ï´Ù:
Before Sorting:
3=Delta
1=Foxtrot
4=Bravo
2=Echo
6=Alpha
5=Charlie

By Key:
1=Foxtrot
2=Echo
3=Delta
4=Bravo
5=Charlie
6=Alpha

By Item:
Alpha=6
Bravo=4
Charlie=5
Delta=3
Echo=2
Foxtrot=1
				

Microsoft´Â ¹¬½ÃÀûÀÎ º¸Áõ ¾øÀÌ ¸ñÀûÀ¸·Î¸¸ ÇÁ·Î±×·¡¹Ö ¿¹Á¦¸¦ Á¦°øÇÕ´Ï´Ù. ÀÌ Æ÷ÇÔµÇÁö¸¸, »óǰ¼º ¶Ç´Â ƯÁ¤ ¸ñÀû¿¡ÀÇ ÀûÇÕ¼º¿¡ ´ëÇÑ ¹¬½ÃÀûÀÎµÈ º¸ÁõÀÌ Á¦ÇѵÇÁö ¾Ê½À´Ï´Ù. ÀÌ ¹®¼­¿¡¼­´Â ¸¸µé·Á¸é ¹× ÇÁ·Î½ÃÀú¸¦ µð¹ö±ëÇÏ´Â µ¥ »ç¿ëµÇ´Â µµ±¸ ¹× ¿©±â¼­ ¼³¸íÇÏ´Â ÇÁ·Î±×·¡¹Ö ¾ð¾î¿¡ Àͼ÷ÇÑ »ç¿ëÀÚ¸¦ ´ë»óÀ¸·Î ÇÕ´Ï´Ù. Microsoft Áö¿ø ¿£Áö´Ï¾î´Â »ç¿ëÀÚ¿¡°Ô µµ¿òÀÌ µÇµµ·Ï ƯÁ¤ ÀýÂ÷¿¡ ´ëÇÑ ±â´ÉÀ» ¼³¸íÇÒ ¼ö ÀÖÁö¸¸ Ãß°¡ ±â´ÉÀ» Á¦°øÇϰųª ƯÁ¤ ¿ä±¸ »çÇ׿¡ ¸Âµµ·Ï ÇÁ·Î½ÃÀú¸¦ ±¸¼ºÇÏÁö´Â ÀÌ ¿¹Á¦¸¦ ¼öÁ¤ÇÏÁö ¾Ê½À´Ï´Ù.
https://partner.microsoft.com/global/30000104
»ç¿ëÇÒ ¼ö ÀÖ´Â Áö¿ø ¿É¼Ç ¹× Microsoft ¿¬¶ôÇÏ´Â ¹æ¹ý¿¡ ´ëÇÑ ÀÚ¼¼ÇÑ ³»¿ëÀº ´ÙÀ½ Microsoft À¥ »çÀÌÆ®¸¦ ¹æ¹®ÇϽʽÿÀ.
http://support.microsoft.com/default.aspx?scid=fh;EN-US;CNTACTMS

ÂüÁ¶

MicrosoftÀÇ ½ºÅ©¸³ÆÃ ±â¼ú¿¡ ´ëÇÑ ÀÚ¼¼ÇÑ ³»¿ëÀº ´ÙÀ½ URL¿¡¼­ Microsoft °³¹ßÀÚ ³×Æ®¿öÅ© À¥ »çÀÌÆ®¸¦ ÂüÁ¶ÇϽʽÿÀ.
http://msdn2.microsoft.com/en-us/library/ms950396.aspx

¼Ó¼º

±â¼ú ÀÚ·á: 246067 - ¸¶Áö¸· °ËÅä: 2007³â 8¿ù 8ÀÏ ¼ö¿äÀÏ - ¼öÁ¤: 3.3
º» ¹®¼­ÀÇ Á¤º¸´Â ´ÙÀ½ÀÇ Á¦Ç°¿¡ Àû¿ëµË´Ï´Ù.
  • Microsoft Internet Information Services 5.0
Ű¿öµå:?
kbmt kbinfo KB246067 KbMtko
±â°è ¹ø¿ªµÈ ¹®¼­
Áß¿ä: º» ¹®¼­´Â Àü¹® ¹ø¿ª°¡°¡ ¹ø¿ªÇÑ °ÍÀÌ ¾Æ´Ï¶ó Microsoft ±â°è ¹ø¿ª ¼ÒÇÁÆ®¿þ¾î·Î ¹ø¿ªÇÑ °ÍÀÔ´Ï´Ù. Microsoft´Â ¹ø¿ª°¡°¡ ¹ø¿ªÇÑ ¹®¼­ ¹× ±â°è ¹ø¿ªµÈ ¹®¼­¸¦ ¸ðµÎ Á¦°øÇϹǷΠMicrosoft ±â¼ú ÀÚ·á¿¡ ÀÖ´Â ¸ðµç ¹®¼­¸¦ Çѱ۷ΠÁ¢ÇÒ ¼ö ÀÖ½À´Ï´Ù. ±×·¯³ª ±â°è ¹ø¿ª ¹®¼­°¡ Ç×»ó ¿Ïº®ÇÑ °ÍÀº ¾Æ´Õ´Ï´Ù. µû¶ó¼­ ±â°è ¹ø¿ª ¹®¼­¿¡´Â ¸¶Ä¡ ¿Ü±¹ÀÎÀÌ Çѱ¹¾î·Î ¸»ÇÒ ¶§ ½Ç¼ö¸¦ ÇÏ´Â °Íó·³ ¾îÈÖ, ±¸¹® ¶Ç´Â ¹®¹ý¿¡ ¿À·ù°¡ ÀÖÀ» ¼ö ÀÖ½À´Ï´Ù. Microsoft´Â ³»¿ë»óÀÇ ¿À¿ª ¶Ç´Â Microsoft °í°´ÀÌ ÀÌ·¯ÇÑ ¿À¿ªÀ» »ç¿ëÇÔÀ¸·Î½á ¹ß»ýÇÏ´Â ºÎ Á¤È®¼º, ¿À·ù ¶Ç´Â ¼ÕÇØ¿¡ ´ëÇØ Ã¥ÀÓÀ» ÁöÁö ¾Ê½À´Ï´Ù. Microsoft´Â ÀÌ·¯ÇÑ ¹®Á¦¸¦ ÇØ°áÇϱâ À§ÇØ ±â°è ¹ø¿ª ¼ÒÇÁÆ®¿þ¾î¸¦ ÀÚÁÖ ¾÷µ¥ÀÌÆ®Çϰí ÀÖ½À´Ï´Ù.
´õ ÀÌ»ó Áö¿øµÇÁö ¾Ê´Â Á¦Ç°ÀÇ KB ³»¿ë¿¡ ´ëÇÑ °íÁö »çÇ×
ÀÌ ¹®¼­¿¡¼­´Â Microsoft¿¡¼­ ´õ ÀÌ»ó Áö¿øÇÏÁö ¾Ê´Â Á¦Ç°¿¡ ´ëÇØ ¼³¸íÇÕ´Ï´Ù. µû¶ó¼­ ÀÌ ¹®¼­´Â "ÀÖ´Â ±×´ë·Î" Á¦°øµÇ¸ç ¾÷µ¥ÀÌÆ®µÇÁö ¾Ê½À´Ï´Ù.

Çǵå¹é º¸³»±â