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 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 |
sub log_g(s) select case VarType(s) case 0 s = "empty" case 1 s = "null" case 9 if typeName(s) = "Dictionary" then keys = s.keys() For Each k In keys response.write k & ": " & s.item(k) & "<br/>" next response.end else s = "object" end if case 11 if s = true then s = "true" else s = "false" end if case 13 s = "data object" case else if VarType(s) > 8192 then for i = 0 to uBound(s) response.write "Array(" & i & "): " & s(i) & "<br/>" next response.end end if end select response.write s response.end end sub Function CharsetBIG5ToUnicode(str) Dim stream if isNull(str) or len(str) = 0 then CharsetBIG5ToUnicode = str else Set stream = CreateObject("ADODB.Stream") stream.Type = 2 'adTypeText stream.Charset = "windows-1252" stream.Open stream.WriteText str stream.Position = 0 stream.Charset = "big5" CharsetBIG5ToUnicode = stream.ReadText end if End Function Function UnicodeToCharsetBIG5(str) Dim stream if isNull(str) or len(str) = 0 then UnicodeToCharsetBIG5 = str else Set stream = CreateObject("ADODB.Stream") stream.Type = 2 'adTypeText stream.Charset = "big5" stream.Open stream.WriteText str stream.Position = 0 stream.Charset = "windows-1252" UnicodeToCharsetBIG5 = stream.ReadText end if End Function function is_empty(s, include_zero) result = false if isNull(include_zero) = true then include_zero = true end if if isNull(s) then result = true end if if result = false and result = "" then result = true end if if result = false and include_zero = true and isnumeric(s) then if cLng(s) = 0 then result = true end if end if is_empty = result end function public function in_array(v, arr) dim result, i result = -1 i = 0 if not isNull(arr) and uBound(arr) > -1 then for i = 0 to uBound(arr) if cStr(arr(i)) = cStr(v) then result = i exit for end if next end if in_array = result end function public function check_int(n) dim digits_str(9), result, i, t result = true if isNull(n) or len(n) = 0 then result = false else for i = 0 to uBound(digits_str) digits_str(i) = cStr(i) next for i = 1 to len(n) t = cstr(n) if in_array(mid(t, i, 1), digits_str) = -1 then result = false exit for end if next end if check_int = result end function public function replaceBR(s) s = replace(s, "<br>", chr(10)) replaceBR = s end function public function replaceChr10(s) s = replace(s, chr(10), "<br>") replaceChr10 = s end function public function replace_quote(input) dim replace_list(11), replace_list_to(11), result, temp_str, replace_index, i result = input replace_list(0) = "'" : replace_list(1) = """" replace_list(2) = "<" : replace_list(3) = ">" replace_list(4) = chr(12) & chr(15) : replace_list(5) = chr(15) & chr(12) replace_list(6) = chr(10) & chr(13) : replace_list(7) = chr(13) & chr(10) replace_list(8) = chr(10) : replace_list(9) = chr(12) replace_list(10) = chr(13) : replace_list(11) = chr(15) replace_list_to(0) = "'" : replace_list_to(1) = """ replace_list_to(2) = "<" : replace_list_to(3) = ">" replace_list_to(4) = "<br/>" : replace_list_to(5) = "<br/>" replace_list_to(6) = "<br/>" : replace_list_to(7) = "<br/>" replace_list_to(8) = "" : replace_list_to(9) = "" replace_list_to(10) = "" : replace_list_to(11) = "" for i = 0 to Ubound(replace_list) if inStr(result, replace_list(i)) > 0 then result = replace(result, replace_list(i), replace_list_to(i)) end if next replace_quote = result end function 'data is disctionary function params(data) str = "" sep = "" keys = data.keys() For Each k In keys str = str & sep & k & "=" & Server.URLEncode(data.item(k)) sep = "&" next params = str end function |