asp 转换汉字为拼音
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
Function CharToQWM(str)
dim sHex,sHigh,sLow,iLow,iHigh,sResult
sHex=Hex(Asc(str))
sHigh=Left(sHex,2)
sLow=Right(sHex,2)
if NOT (sHigh>="A1" AND sHigh<="FE") then
CharToQWM=""
Exit Function
end if
if NOT (sLow>="A1" AND sLow<="FE") then
CharToQWM=""
Exit Function
end if
iLow=Clng("&H" & sLow)-128
iHigh=Clng("&H" & sHigh)-128
iLow=iLow-32
iHigh=iHigh-32
sResult=""
if iHigh<10 then
sResult = sResult & "0" & Cstr(iHigh)
else
sResult = sResult & Cstr(iHigh)
end if
if iLow<10 then
sResult = sResult & "0" & Cstr(iLow)
else
sResult = sResult & Cstr(iLow)
end if
CharToQWM=sResult
End Function
function getpychar(GBCode)
if GBCode="" then
getpychar=""
elseif (GBCode >= 1601 and GBCode < 1637) then
getpychar="a"
elseif (GBCode >= 1637 and GBCode < 1833) then
getpychar= "b"
elseif (GBCode >= 1833 and GBCode < 2078) then
getpychar= "c"
elseif (GBCode >= 2078 and GBCode < 2274) then
getpychar= "d"
elseif (GBCode >= 2274 and GBCode < 2302) then
getpychar= "e"
elseif (GBCode >= 2302 and GBCode < 2433) then
getpychar= "f"
elseif (GBCode >= 2433 and GBCode < 2594) then
getpychar= "g"
elseif (GBCode >= 2594 and GBCode < 2787) then
getpychar= "h"
elseif (GBCode >= 2787 and GBCode < 3106) then
getpychar= "j"
elseif (GBCode >= 3106 and GBCode < 3212) then
getpychar= "k"
elseif (GBCode >= 3212 and GBCode < 3472) then
getpychar= "l"
elseif (GBCode >= 3472 and GBCode < 3635) then
getpychar= "m"
elseif (GBCode >= 3635 and GBCode < 3722) then
getpychar= "n"
elseif (GBCode >= 3722 and GBCode < 3730) then
getpychar= "o"
elseif (GBCode >= 3730 and GBCode < 3858) then
getpychar= "p"
elseif (GBCode >= 3858 and GBCode < 4027) then
getpychar= "q"
elseif (GBCode >= 4027 and GBCode < 4086) then
getpychar= "r"
elseif (GBCode >= 4086 and GBCode < 4390) then
getpychar= "s"
'elseif (GBCode >= 4117 and GBCode < 4390) then
'getpychar= "sh"
elseif (GBCode >= 4390 and GBCode < 4558) then
getpychar= "t"
elseif (GBCode >= 4558 and GBCode < 4684) then
getpychar= "w"
elseif (GBCode >= 4684 and GBCode < 4925) then
getpychar= "x"
elseif (GBCode >= 4925 and GBCode < 5249) then
getpychar= "y"
elseif (GBCode >= 5249 and GBCode < 5589) then
getpychar= "z"
'if (GBCode >= 5290 && GBCode <= 5589) then
'getpychar= "zh";
elseif (GBCode >= 5601 and GBCode <= 8794) then
CodeData = "cjwgnspgcenegypbtwxzdxykygtpjnmjqmbsgzscyjsyyfpggbzgydywjkgaljswkbjqhyjwpdzlsgmrybywwccgznkydgttngjeyekzydcjnmcylqlypyqbqrpzslwbdgkjfyxjwcltbncxjjjjcxdtqsqzycdxxhgckbphffsspybgmxjbbyglbhlssmzmpjhsojnghdzcdklgjhsgqzhxqgkezzwymcscjnyetxadzpmdssmzjjqjyzcjjfwqjbdzbjgdnzcbwhgxhqkmwfbpbqdtjjzkqhylcgxfptyjyyzpsjlfchmqshgmmxsxjpkdcmbbqbefsjwhwwgckpylqbgldlcctnmaeddksjngkcsgxlhzaybdbtsdkdylhgymylcxpycjndqjwxqxfyyfjlejbzrwccqhqcsbzkymgplbmcrqcflnymyqmsqtrbcjthztqfrxchxmcjcjlxqgjmshzkbswxemdlckfsydsglycjjssjnqbjctyhbftdcyjdgwyghqfrxwckqkxebpdjpxjqsrmebwgjlbjslyysmdxlclqkxlhtjrjjmbjhxhwywcbhtrxxglhjhfbmgykldyxzpplggpmtcbbajjzyljtyanjgbjflqgdzyqcaxbkclecjsznslyzhlxlzcghbxzhznytdsbcjkdlzayffydlabbgqszkggldndnyskjshdlxxbcghxyggdjmmzngmmccgwzszxsjbznmlzdthcqydbdllscddnlkjyhjsycjlkohqasdhnhcsgaehdaashtcplcpqybsdmpjlpcjaqlcdhjjasprchngjnlhlyyqyhwzpnccgwwmzffjqqqqxxaclbhkdjxdgmmydjxzllsygxgkjrywzwyclzmcsjzldbndcfcxyhlschycjqppqagmnyxpfrkssbjlyxyjjglnscmhcwwmnzjjlhmhchsyppttxrycsxbyhcsmxjsxnbwgpxxtaybgajcxlypdccwqocwkccsbnhcpdyznbcyytyckskybsqkkytqqxfcwchcwkelcqbsqyjqcclmthsywhmktlkjlychwheqjhtjhppqpqscfymmcmgbmhglgsllysdllljpchmjhwljcyhzjxhdxjlhxrswlwzjcbxmhzqxsdzpmgfcsglsdymjshxpjxomyqknmyblrthbcftpmgyxlchlhlzylxgsssscclsldclepbhshxyyfhbmgdfycnjqwlqhjjcywjztejjdhfblqxtqkwhdchqxagtlxljxmsljhdzkzjecxjcjnmbbjcsfywkbjzghysdcpqyrsljpclpwxsdwejbjcbcnaytmgmbapclyqbclzxcbnmsggfnzjjbzsfqyndxhpcqkzczwalsbccjxpozgwkybsgxfcfcdkhjbstlqfsgdslqwzkxtmhsbgzhjcrglyjbpmljsxlcjqqhzmjczydjwbmjklddpmjegxyhylxhlqyqhkycwcjmyhxnatjhyccxzpcqlbzwwwtwbqcmlbmynjcccxbbsnzzljpljxyztzlgcldcklyrzzgqtgjhhgjljaxfgfjzslcfdqzlclgjdjcsnclljpjqdcclcjxmyzftsxgcgsbrzxjqqcczhgyjdjqqlzxjyldlbcyamcstylbdjbyregklzdzhldszchznwczcllwjqjjjkdgjcolbbzppglghtgzcygezmycnqcycyhbhgxkamtxyxnbskyzzgjzlqjdfcjxdygjqjjpmgwgjjjpkjsbgbmmcjssclpqpdxcdyykypcjddyygywchjrtgcnyqldkljczzgzccjgdyksgpzmdlcphnjafyzdjcnmwescsglbtzcgmsdllyxqsxsbljsbbsgghfjlwpmzjnlyywdqshzxtyywhmcyhywdbxbtlmswyyfsbjcbdxxlhjhfpsxzqhfzmqcztqcxzxrdkdjhnnyzqqfnqdmmgnydxmjgdhcdycbffallztdltfkmxqzdngeqdbdczjdxbzgsqqddjcmbkxffxmkdmcsychzcmljdjynhprsjmkmpcklgdbqtfzswtfgglyplljzhgjjgypzltcsmcnbtjbhfkdhbyzgkpbbymtdlsxsbnpdkleycjnycdykzddhqgsdzsctarlltkzlgecllkjljjaqnbdggghfjtzqjsecshalqfmmgjnlyjbbtmlycxdcjpldlpcqdhsycbzsckbzmsljflhrbjsnbrgjhxpdgdjybzgdlgcsezgxlblgyxtwmabchecmwyjyzlljjshlgndjlslygkdzpzxjyyzlpcxszfgwyydlyhcljscmbjhblyjlycblydpdqysxktbytdkdxjypcnrjmfdjgklccjbctbjddbblblcdqrppxjcglzcshltoljnmdddlngkaqakgjgyhheznmshrphqqjchgmfprxcjgdychghlyrzqlcngjnzsqdkqjymszswlcfqjqxgbggxmdjwlmcrnfkkfsyyljbmqammmycctbshcptxxzzsmphfshmclmldjfyqxsdyjdjjzzhqpdszglssjbckbxyqzjsgpsxjzqznqtbdkwxjkhhgflbcsmdldgdzdblzkycqnncsybzbfglzzxswmsccmqnjqsbdqsjtxxmbldxcclzshzcxrqjgjylxzfjphymzqqydfqjjlcznzjcdgzygcdxmzysctlkphtxhtlbjxjlxscdqccbbqjfqzfsltjbtkqbsxjjljchczdbzjdczjccprnlqcgpfczlclcxzdmxmphgsgzgszzqjxlwtjpfsyaslcjbtckwcwmytcsjjljcqlwzmalbxyfbpnlschtgjwejjxxglljstgshjqlzfkcgnndszfdeqfhbsaqdgylbxmmygszldydjmjjrgbjgkgdhgkblgkbdmbylxwcxyttybkmrjjzxqjbhlmhmjjzmqasldcyxyqdlqcafywyxqhz"
gbcodetmp = GBCode
pos = (cint(left(gbcodetmp ,2)) - 56) * 94 + cint(mid(gbcodetmp ,len(gbcodetmp) - 1, 2))
getpychar=mid(CodeData,pos, 1)
end if
end function
dim sHex,sHigh,sLow,iLow,iHigh,sResult
sHex=Hex(Asc(str))
sHigh=Left(sHex,2)
sLow=Right(sHex,2)
if NOT (sHigh>="A1" AND sHigh<="FE") then
CharToQWM=""
Exit Function
end if
if NOT (sLow>="A1" AND sLow<="FE") then
CharToQWM=""
Exit Function
end if
iLow=Clng("&H" & sLow)-128
iHigh=Clng("&H" & sHigh)-128
iLow=iLow-32
iHigh=iHigh-32
sResult=""
if iHigh<10 then
sResult = sResult & "0" & Cstr(iHigh)
else
sResult = sResult & Cstr(iHigh)
end if
if iLow<10 then
sResult = sResult & "0" & Cstr(iLow)
else
sResult = sResult & Cstr(iLow)
end if
CharToQWM=sResult
End Function
function getpychar(GBCode)
if GBCode="" then
getpychar=""
elseif (GBCode >= 1601 and GBCode < 1637) then
getpychar="a"
elseif (GBCode >= 1637 and GBCode < 1833) then
getpychar= "b"
elseif (GBCode >= 1833 and GBCode < 2078) then
getpychar= "c"
elseif (GBCode >= 2078 and GBCode < 2274) then
getpychar= "d"
elseif (GBCode >= 2274 and GBCode < 2302) then
getpychar= "e"
elseif (GBCode >= 2302 and GBCode < 2433) then
getpychar= "f"
elseif (GBCode >= 2433 and GBCode < 2594) then
getpychar= "g"
elseif (GBCode >= 2594 and GBCode < 2787) then
getpychar= "h"
elseif (GBCode >= 2787 and GBCode < 3106) then
getpychar= "j"
elseif (GBCode >= 3106 and GBCode < 3212) then
getpychar= "k"
elseif (GBCode >= 3212 and GBCode < 3472) then
getpychar= "l"
elseif (GBCode >= 3472 and GBCode < 3635) then
getpychar= "m"
elseif (GBCode >= 3635 and GBCode < 3722) then
getpychar= "n"
elseif (GBCode >= 3722 and GBCode < 3730) then
getpychar= "o"
elseif (GBCode >= 3730 and GBCode < 3858) then
getpychar= "p"
elseif (GBCode >= 3858 and GBCode < 4027) then
getpychar= "q"
elseif (GBCode >= 4027 and GBCode < 4086) then
getpychar= "r"
elseif (GBCode >= 4086 and GBCode < 4390) then
getpychar= "s"
'elseif (GBCode >= 4117 and GBCode < 4390) then
'getpychar= "sh"
elseif (GBCode >= 4390 and GBCode < 4558) then
getpychar= "t"
elseif (GBCode >= 4558 and GBCode < 4684) then
getpychar= "w"
elseif (GBCode >= 4684 and GBCode < 4925) then
getpychar= "x"
elseif (GBCode >= 4925 and GBCode < 5249) then
getpychar= "y"
elseif (GBCode >= 5249 and GBCode < 5589) then
getpychar= "z"
'if (GBCode >= 5290 && GBCode <= 5589) then
'getpychar= "zh";
elseif (GBCode >= 5601 and GBCode <= 8794) then
CodeData = "cjwgnspgcenegypbtwxzdxykygtpjnmjqmbsgzscyjsyyfpggbzgydywjkgaljswkbjqhyjwpdzlsgmrybywwccgznkydgttngjeyekzydcjnmcylqlypyqbqrpzslwbdgkjfyxjwcltbncxjjjjcxdtqsqzycdxxhgckbphffsspybgmxjbbyglbhlssmzmpjhsojnghdzcdklgjhsgqzhxqgkezzwymcscjnyetxadzpmdssmzjjqjyzcjjfwqjbdzbjgdnzcbwhgxhqkmwfbpbqdtjjzkqhylcgxfptyjyyzpsjlfchmqshgmmxsxjpkdcmbbqbefsjwhwwgckpylqbgldlcctnmaeddksjngkcsgxlhzaybdbtsdkdylhgymylcxpycjndqjwxqxfyyfjlejbzrwccqhqcsbzkymgplbmcrqcflnymyqmsqtrbcjthztqfrxchxmcjcjlxqgjmshzkbswxemdlckfsydsglycjjssjnqbjctyhbftdcyjdgwyghqfrxwckqkxebpdjpxjqsrmebwgjlbjslyysmdxlclqkxlhtjrjjmbjhxhwywcbhtrxxglhjhfbmgykldyxzpplggpmtcbbajjzyljtyanjgbjflqgdzyqcaxbkclecjsznslyzhlxlzcghbxzhznytdsbcjkdlzayffydlabbgqszkggldndnyskjshdlxxbcghxyggdjmmzngmmccgwzszxsjbznmlzdthcqydbdllscddnlkjyhjsycjlkohqasdhnhcsgaehdaashtcplcpqybsdmpjlpcjaqlcdhjjasprchngjnlhlyyqyhwzpnccgwwmzffjqqqqxxaclbhkdjxdgmmydjxzllsygxgkjrywzwyclzmcsjzldbndcfcxyhlschycjqppqagmnyxpfrkssbjlyxyjjglnscmhcwwmnzjjlhmhchsyppttxrycsxbyhcsmxjsxnbwgpxxtaybgajcxlypdccwqocwkccsbnhcpdyznbcyytyckskybsqkkytqqxfcwchcwkelcqbsqyjqcclmthsywhmktlkjlychwheqjhtjhppqpqscfymmcmgbmhglgsllysdllljpchmjhwljcyhzjxhdxjlhxrswlwzjcbxmhzqxsdzpmgfcsglsdymjshxpjxomyqknmyblrthbcftpmgyxlchlhlzylxgsssscclsldclepbhshxyyfhbmgdfycnjqwlqhjjcywjztejjdhfblqxtqkwhdchqxagtlxljxmsljhdzkzjecxjcjnmbbjcsfywkbjzghysdcpqyrsljpclpwxsdwejbjcbcnaytmgmbapclyqbclzxcbnmsggfnzjjbzsfqyndxhpcqkzczwalsbccjxpozgwkybsgxfcfcdkhjbstlqfsgdslqwzkxtmhsbgzhjcrglyjbpmljsxlcjqqhzmjczydjwbmjklddpmjegxyhylxhlqyqhkycwcjmyhxnatjhyccxzpcqlbzwwwtwbqcmlbmynjcccxbbsnzzljpljxyztzlgcldcklyrzzgqtgjhhgjljaxfgfjzslcfdqzlclgjdjcsnclljpjqdcclcjxmyzftsxgcgsbrzxjqqcczhgyjdjqqlzxjyldlbcyamcstylbdjbyregklzdzhldszchznwczcllwjqjjjkdgjcolbbzppglghtgzcygezmycnqcycyhbhgxkamtxyxnbskyzzgjzlqjdfcjxdygjqjjpmgwgjjjpkjsbgbmmcjssclpqpdxcdyykypcjddyygywchjrtgcnyqldkljczzgzccjgdyksgpzmdlcphnjafyzdjcnmwescsglbtzcgmsdllyxqsxsbljsbbsgghfjlwpmzjnlyywdqshzxtyywhmcyhywdbxbtlmswyyfsbjcbdxxlhjhfpsxzqhfzmqcztqcxzxrdkdjhnnyzqqfnqdmmgnydxmjgdhcdycbffallztdltfkmxqzdngeqdbdczjdxbzgsqqddjcmbkxffxmkdmcsychzcmljdjynhprsjmkmpcklgdbqtfzswtfgglyplljzhgjjgypzltcsmcnbtjbhfkdhbyzgkpbbymtdlsxsbnpdkleycjnycdykzddhqgsdzsctarlltkzlgecllkjljjaqnbdggghfjtzqjsecshalqfmmgjnlyjbbtmlycxdcjpldlpcqdhsycbzsckbzmsljflhrbjsnbrgjhxpdgdjybzgdlgcsezgxlblgyxtwmabchecmwyjyzlljjshlgndjlslygkdzpzxjyyzlpcxszfgwyydlyhcljscmbjhblyjlycblydpdqysxktbytdkdxjypcnrjmfdjgklccjbctbjddbblblcdqrppxjcglzcshltoljnmdddlngkaqakgjgyhheznmshrphqqjchgmfprxcjgdychghlyrzqlcngjnzsqdkqjymszswlcfqjqxgbggxmdjwlmcrnfkkfsyyljbmqammmycctbshcptxxzzsmphfshmclmldjfyqxsdyjdjjzzhqpdszglssjbckbxyqzjsgpsxjzqznqtbdkwxjkhhgflbcsmdldgdzdblzkycqnncsybzbfglzzxswmsccmqnjqsbdqsjtxxmbldxcclzshzcxrqjgjylxzfjphymzqqydfqjjlcznzjcdgzygcdxmzysctlkphtxhtlbjxjlxscdqccbbqjfqzfsltjbtkqbsxjjljchczdbzjdczjccprnlqcgpfczlclcxzdmxmphgsgzgszzqjxlwtjpfsyaslcjbtckwcwmytcsjjljcqlwzmalbxyfbpnlschtgjwejjxxglljstgshjqlzfkcgnndszfdeqfhbsaqdgylbxmmygszldydjmjjrgbjgkgdhgkblgkbdmbylxwcxyttybkmrjjzxqjbhlmhmjjzmqasldcyxyqdlqcafywyxqhz"
gbcodetmp = GBCode
pos = (cint(left(gbcodetmp ,2)) - 56) * 94 + cint(mid(gbcodetmp ,len(gbcodetmp) - 1, 2))
getpychar=mid(CodeData,pos, 1)
end if
end function