关于从汉字转换首个拼音字母的问题
我以前从论坛上抄了一个转换的程序,现在需要一个快速查询用到这个小程序,但是我发现有时会出错,请师傅们能不能看看。achHZString="采花"
local achPYString,i,j,chPY,achHZ
achPYString=''
set collate to 'PINYIN'
achPYCode='八嚓咑妸发旮铪讥讥咔垃呣拿讴趴七呥仨他哇哇哇夕丫匝咗'
for i=1 to len(achHZString)
if asc(substr(achHZString,i,1))>160
achHZ=substr(achHZString,i,2)
chPY=''
for j=1 to 26
if substrc(achHZ,1,1)<substrc(achPYCode,j,1)
chPY=chr(asc('a')+j-1)
exit
endif
endfor
achPYString=achPYString+upper(chPY)
i=i+1
else
if (asc(substr(achHZString,i,1))>32)
achPYString=achPYString+upper(substr(achHZString,i,1))
endif
endif
endfor
=MESSAGEBOX(achPYString)