1、把汉字变为拼音的vfp原程序*hztop.prg*用法是 ?hztop(“在地下早是”) 得的结果就是 : zdxzs *以下是用到的几个子程序 希望大家在工作中能用到*PARA CQ &把几个汉字变成拼音编码CQ=ALLTRIM(CQ)CCCC= &存放拼音编码DO WHILE .T.* IF PDHZ(CQ) ELSE CQ=SUBS(CQ,2) *CCCC=CCCC+ &这个要是加上的话可以把不是汉字变为空的对应出来 IF EMPTY(CQ) EXIT ENDI LOOP ENDI* *上面这段加上可以把不是汉字的去了* CCCC=CCCC+HTOP(CQ) CQ=SUBS(CQ,3)
2、IF EMPTY(CQ) EXIT ENDIENDDRETU CCCC* pdhz.prgPARA HZ & 判断是否为汉字 16到87为汉字 1到87为全角字符HZ=SUBS(HZ,1,2)CChz=HTOQ(HZ)CCCCN=VAL(SUBS(CChz,1,2)IF CCCCN=16.AND.CCCCN=87 RETU .T.ELSE RETU .F.ENDI*htoq.prgPARA CQ &汉字变区位IF TYPE(CQ)C RETU ENDIRETU NTOC(ASC(SUBS(CQ,1,1)-160)+NTOC(ASC(SUBS(CQ,2,1)-160)*htop.prgPARA
3、CQ &汉字变拼音KKKK=VAL(HTOQ(CQ)DO CASE CASE INLIST(KKKK,5847,5974,5991,6254,6263,6278,6325,6427,6436,6440,6441,6514,6577,6654,6658,6959,7033,7040,7081,7208,7281,7365,7451) RETU a CASE KKKK=1601.AND.KKKK=1637.AND.KKKK=1833.AND.KKKK=2078.AND.KKKK=2274.AND.KKKK=2302.AND.KKKK=2433.AND.KKKK=2594.AND.KKKK=2787
4、.AND.KKKK=3106.AND.KKKK=3212.AND.KKKK=3471 RETU l CASE INLIST(KKKK,6116,6125,6168,6181,6185,6192,6194,6204,6228,6238,6245,6259,6270,6291,6303,6323,6331,6342,6354,6375,6388,6405,6406) RETU l CASE INLIST(KKKK,6412,6422,6447,6458,6464,6480,6482,6516,6532,6533,6548,6555,6566,6591,6604,6618,6662,6722,6733,6744,6747,6778,6781) RETU l CASE INLIST(KKKK,6782,6786,6788,6803,6815,6821,6843,6864,6877,6880,6882,6885,6894,6902,6905,6928,6946,6954,