티스토리 뷰

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
Function RegExpTest(Pattern, Str)
    Dim RegExp
    SET RegExp = New RegExp
    RegExp.Pattern = Pattern
    RegExp.IgnoreCase = True
    RegExpTest = RegExp.Test(Str)
    SET RegExp = Nothing
End Function
 
Function in_array(element, arr)
  in_array = False
  For i=0 To Ubound(arr)
     If Trim(arr(i)) = Trim(element) Then
        in_array = True
        Exit Function      
     End If
  Next
End Function
 
Function floor(x)
    dim temp
    temp = Round(x)
    if temp > x then
        temp = temp - 1
    end if
    floor = temp
end Function
 
function bubbleSortArray(arrShort, ascFlag)
    for i = UBound(arrShort) - 1 To 0 Step -1
        for j= 0 to i
            if ascFlag then
                if arrShort(j)>arrShort(j+1then
                    temp=arrShort(j+1)
                    arrShort(j+1)=arrShort(j)
                    arrShort(j)=temp
                end if
            else
                if arrShort(j)<arrShort(j+1then
                    temp=arrShort(j+1)
                    arrShort(j+1)=arrShort(j)
                    arrShort(j)=temp
                end if
            end if                
        next
    next
    bubbleSortArray = arrShort
end function
 
function selectionSortArray(arrShort, ascFlag, sortSize)
    arrShortSize = UBound(arrShort) + 1
    for i = 0 To arrShortSize-2 Step 1
        if i < sortSize then
            for j = i+1 to arrShortSize-1 step 1
                if ascFlag then
                    if arrShort(i) > arrShort(j) then
                        temp=arrShort(i)
                        arrShort(i)=arrShort(j)
                        arrShort(j)=temp
                    end if
                else
                    if arrShort(i) < arrShort(j) then
                        temp=arrShort(i)
                        arrShort(i)=arrShort(j)
                        arrShort(j)=temp
                    end if
                end if
            next
        else
            exit for
        end if
    next
    selectionSortArray = arrShort
end function
cs


'프로그래밍' 카테고리의 다른 글

ASP ODBC MySQL 사용  (0) 2016.12.07
ASP UTF-8 파일 읽고 출력  (0) 2016.12.07
PHP Recursive copy & mkdir function  (0) 2016.12.01
airspeed를 사용한 템플릿 설정 관리  (0) 2016.10.19
pyparsing을 사용한 bacula 설정 파서  (0) 2016.10.19
댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
페이지
«   2024/11   »
1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
글 보관함