Add 메서드

         :   키-항목 쌍을 Dictionary 개체에 추가합니다.

문법    :   object.Add key, item

구성요소

설   명

object

필수적인 요소. 항상 Dictionary 개체의 이름입니다.

key

필수적인 요소. 추가할 item과 연관된 key입니다.

item

필수적인 요소. 추가할 key와 연관된 item입니다.

설명

해당 key가 이미 있으면 오류가 발생합니다.
아래 예제는 Add 메서드 사용법을 보여줍니다:

     Dim d                                                       '변수를 작성합니다.
     Set d = CreateObject("Scripting.Dictionary")
     d.Add "a", "Athens"                                   '키와 항목을 추가합니다.
     d.Add "b", "Belgrade"
     d.Add "c", "Cairo"

- Exists 메서드

        :  Dictionary 개체에 지정한 키가 있으면 True를, 없으면 False를 반환합니다.

문법   :  object.Exists(key)

구성요소

설   명

object

필수적인 요소. 항상 Dictionary 개체의 이름입니다.

key

필수적인 요소. Dictionary 개체에서 찾을 key 값입니다.

설명

아래 예제는 Exists 메서드 사용법을 보여줍니다.
    Function KeyExistsDemo
         Dim d, msg                                           '변수를 작성합니다.
         Set d = CreateObject("Scripting.Dictionary")
         d.Add "a", "Athens"                               '키와 항목을 추가합니다.
         d.Add "b", "Belgrade"
         d.Add "c", "Cairo"
         If d.Exists("c") Then
                  msg = "지정한 키가 있습니다."
         Else
                  msg = "지정한 키가 없습니다."
         End If
         KeyExistsDemo = msg
    End Function

- Items 메서드

        :  Dictionary 개체의 모든 항목이 들어있는 배열을 반환합니다.

문법   :   object.Items
               object는 항상 Dictionary 개체의 이름입니다.

설명

아래 코드에서는 Items 메서드의 사용 방법을 보여줍니다.
       Function DicDemo
              Dim a, d, i, s                                     '변수를 작성합니다.
              Set d = CreateObject("Scripting.Dictionary")
              d.Add "a", "Athens"                           '키와 항목을 추가합니다.
              d.Add "b", "Belgrade"
              d.Add "c", "Cairo"

              a = d.Items                                       '항목을 가져옵니다.
              For i = 0 To d.Count -1                     '배열을 반복합니다.
                     s = s & a(i) & "<BR>"                  '반환 문자열을 작성합니다.
              Next
              DicDemo = s
       End Function

- Keys 메서드

        :   Dictionary 개체에 있는 모든 키를 포함하는 배열을 반환합니다.

문법   :   object.Keys
              object는 항상 Dictionary 개체의 이름입니다.

설명

아래 코드에서는 Keys 메서드의 사용 방법을 보여줍니다.
     Function DicDemo
          Dim a, d, i                                        '변수를 작성합니다.
          Set d = CreateObject("Scripting.Dictionary")
          d.Add "a", "Athens"                         '키와 항목을 추가합니다.
          d.Add "b", "Belgrade"
          d.Add "c", "Cairo"
          a = d.Keys                                     '키를 가져옵니다.
          For i = 0 To d.Count -1                   '배열을 반복합니다.
               s = s & a(i) & "<BR>"                   '결과를 반환합니다.
          Next
          DicDemo = s
     End Function

- Remove 메서드

        : Dictionary 개체에서 키-항목 쌍을 제거합니다.

문법   : object.Remove(key)

구성요소

설   명

object

필수적인 요소. 항상 Dictionary 개체의 이름입니다.

key

필수적인 요소. key 구성 요소는 Dictionary 개체에서 제거할 키-항목 쌍과 연관된 키입니다.

설명

지정된 키-항목 쌍이 없는 경우 오류가 발생합니다.
아래 코드에서는 Remove 메서드의 사용 방법을 보여줍니다.

      Dim a, d                                                 '변수를 작성합니다.
      Set d = CreateObject("Scripting.Dictionary")
      d.Add "a", "Athens"                               '키와 항목을 추가합니다.
      d.Add "b", "Belgrade"
      d.Add "c", "Cairo"
      ...
      a = d.Remove("b")                                  '둘째 쌍을 제거합니다.

- RemoveAll 메서드

        : RemoveAll 메서드는 Dictionary 개체에서 키-항목 쌍을 제거합니다.

문법   : object.RemoveAll
            object는 항상 Dictionary 개체의 이름입니다.

설명

아래 코드에서는 RemoveAll 메서드의 사용 방법을 보여줍니다.
       Dim a, d, i                         '변수를 작성합니다.
       Set d = CreateObject("Scripting.Dictionary")
       d.Add "a", "Athens"             '키와 항목을 추가합니다.
       d.Add "b", "Belgrade"
       d.Add "c", "Cairo"
       ...
       a = d.RemoveAll             '사전을 지웁니다. 

'Source Storage > Programming' 카테고리의 다른 글

Microsoft Log Parser 2.2  (0) 2008.03.28
Windows Server 2008 Release  (0) 2007.10.02
JavaScript String Object  (0) 2007.07.31
날이면 날마다 까먹는 정규식 구성요소 (RegExp)  (0) 2007.04.18
HTML 특수문자 코드표  (0) 2007.03.21
String 객체의 모든 메소드
Method Description FF N IE
anchor() Creates an HTML anchor 1 2 3
big() Displays a string in a big font 1 2 3
blink() Displays a blinking string 1 2  
bold() Displays a string in bold 1 2 3
charAt() Returns the character at a specified position 1 2 3
charCodeAt() Returns the Unicode of the character at a specified position 1 4 4
concat() Joins two or more strings 1 4 4
fixed() Displays a string as teletype text 1 2 3
fontcolor() Displays a string in a specified color 1 2 3
fontsize() Displays a string in a specified size 1 2 3
fromCharCode() Takes the specified Unicode values and returns a string 1 4 4
indexOf() Returns the position of the first occurrence of a specified string value in a string 1 2 3
italics() Displays a string in italic 1 2 3
lastIndexOf() Returns the position of the last occurrence of a specified string value, searching backwards from the specified position in a string 1 2 3
link() Displays a string as a hyperlink 1 2 3
match() Searches for a specified value in a string 1 4 4
replace() Replaces some characters with some other characters in a string 1 4 4
search() Searches a string for a specified value 1 4 4
slice() Extracts a part of a string and returns the extracted part in a new string 1 4 4
small() Displays a string in a small font 1 2 3
split() Splits a string into an array of strings 1 4 4
strike() Displays a string with a strikethrough 1 2 3
sub() Displays a string as subscript 1 2 3
substr() Extracts a specified number of characters in a string, from a start index 1 4 4
substring() Extracts the characters in a string between two specified indices 1 2 3
sup() Displays a string as superscript 1 2 3
toLowerCase() Displays a string in lowercase letters 1 2 3
toUpperCase() Displays a string in uppercase letters 1 2 3
toSource() Represents the source code of an object 1 4 -
valueOf() Returns the primitive value of a String object 1 2 4

String 객체의 모든 속성들
Property Description FF N IE
constructor A reference to the function that created the object 1 4 4
length Returns the number of characters in a string 1 2 3
prototype Allows you to add properties and methods to the object 1 2 4

+ Recent posts