### 02.使用Classic ASP將Unicode文字一一列出

 ``````<% '' Hex to Dec Function Hex2Dec(strHex) strHex = UCase(strHex) For i = 1 To Len(strHex) Select Case Mid(strHex, Len(strHex)-i+1, 1) Case "0": nDec = nDec + 16^(i-1) * 0 Case "1": nDec = nDec + 16^(i-1) * 1 Case "2": nDec = nDec + 16^(i-1) * 2 Case "3": nDec = nDec + 16^(i-1) * 3 Case "4": nDec = nDec + 16^(i-1) * 4 Case "5": nDec = nDec + 16^(i-1) * 5 Case "6": nDec = nDec + 16^(i-1) * 6 Case "7": nDec = nDec + 16^(i-1) * 7 Case "8": nDec = nDec + 16^(i-1) * 8 Case "9": nDec = nDec + 16^(i-1) * 9 Case "A": nDec = nDec + 16^(i-1) * 10 Case "B": nDec = nDec + 16^(i-1) * 11 Case "C": nDec = nDec + 16^(i-1) * 12 Case "D": nDec = nDec + 16^(i-1) * 13 Case "E": nDec = nDec + 16^(i-1) * 14 Case "F": nDec = nDec + 16^(i-1) * 15 End Select Next Hex2Dec = nDec End Function ''Dec to Hex Function Dec2Hex(nDec) Dec2Hex = "" While nDec > 0 zMod = CStr(nDec Mod 16) Select Case zMod Case "10": zHex = "A" Case "11": zHex = "B" Case "12": zHex = "C" Case "13": zHex = "D" Case "14": zHex = "E" Case "15": zHex = "F" Case else : zHex = zMod End Select Dec2Hex = zHex & Dec2Hex nDec = fix(nDec / 16) wend End Function zHex1 = "4E00" zHex2 = "9FCF" nStart = Hex2Dec(zHex1) nEnd = Hex2Dec(zHex2) ''Display 4E00 to 9FCF nSeq = nStart response.write "" while nSeq <= nEnd response.write "
" response.write "" &_ "&#x" & Dec2Hex(CDBL(nSeq)) & ";
" &_ "" &_ Cstr(Dec2Hex(CDBL(nSeq))) & "" response.write "
" for j = 0 to 15 response.write "" nSeq = nSeq +1 next response.write "" wend response.write "" %> ``````