프로그래밍
ASP 유용한 사용자 정의 함수
warpmemory
2016. 12. 7. 17:46
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+1) then temp=arrShort(j+1) arrShort(j+1)=arrShort(j) arrShort(j)=temp end if else if arrShort(j)<arrShort(j+1) then 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 |