將全角的字符轉(zhuǎn)變成半角字符,將半角轉(zhuǎn)變成全角 % Function DSConvert(vString,vFlag) Rem vFlag為0時表示從全角轉(zhuǎn)為半角,為其他時表示從半角轉(zhuǎn)為全角 Dim i,tmpSingleCharaASC,TempResult,SAscString,DAscString SAscString = "1,2,3,4,5,6,7,8,14,15,16,17,18,19,20,21,22,23,24,25,26,27,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"
TempResult = "" If Len(vString) = 0 Then Response.Write "Parameters Error! Please Check Your Parameters!" : Response.End : Exit Function For i=1 to Len(vString) tmpSingleCharaASC = Asc(Mid(vString,i,1)) If vFlag = 0 Then If InStr(DAscString,tmpSingleCharaASC) > 0 and len(Cstr(tmpSingleCharaASC)) = 6 Then TempResult = TempResult Chr(tmpSingleCharaASC+23680) Else TempResult = TempResult Chr(tmpSingleCharaASC) End If Else If InStr(SAscString,tmpSingleCharaASC) > 0 and Len(Cstr(tmpSingleCharaASC))=4 Then TempResult = TempResult Chr(tmpSingleCharaASC-23680) Else TempResult = TempResult Chr(tmpSingleCharaASC) End If End If Next DSConvert = TempResult End Function %> 全角轉(zhuǎn)半角 %= DSConvert("1234566465454",0)%> 半角轉(zhuǎn)全角 %= DSConvert("1234567890132131",1)%>