汉字转拼音首字

CLOSE all
Clear
USE ptype
* 商品名称
DO while .not.eof()
 REPLACE fullname WITH strtran(ALLTRIM(fullname),"(","(")
 REPLACE fullname WITH strtran(ALLTRIM(fullname),")",")")
 REPLACE usercode with upper(MYhzsx(fullname))
 Skip
ENDDO

USE BTYPE
* 往来单位
DO WHILE .NOT. EOF()
 REPLACE usercode WITH  upper(MYhzsx(fullname))
 Skip
ENDDO
SELECT BTYPE.name, BTYPE.fullname, BTYPE.level, BTYPE.sonnum,;
 BTYPE.usercode;
 FROM BTYPE;
 ORDER BY BTYPE.usercode


SELECT * FROM ptype;
 ORDER BY ptype.usercode
USE
CLOSE all
CLOSE DATABASE


******************************************************
*过程名称:hzpy
*过程功能:汉字转拼音首字
*调用方法:?hzpy('汉字拼音') 结果:HZPY
******************************************************PROCEDURE hzpy

 


******************************************************
*过程名称:hzpy
*过程功能:汉字转拼音首字
*调用方法:?hzpy('汉字拼音') 结果:HZPY
******************************************************PROCEDURE hzpy
*!* PARAMETER MYhzsx(HZstr)
*!* LOCAL PYstr,i,j,C,hz

function MYhzsx(HZstr)
LOCAL PYstr,i,j,C,hz
PYstr=''
IF TYPE("_PYCode_")="U"
   PUBLIC _PBSTR_
 * _PYCode_="吖八嚓咑妸发旮铪讥讥咔垃呣拿讴趴七呥仨他哇哇哇夕丫匝咗"
  _PYCode_="吖八嚓咑妸发旮铪讥讥咔垃妈拿讴趴七呥仨他哇哇哇夕丫匝咗"
ENDIF
FOR  i=1 to len(HZstr)
   IF ASC(SUBSTR(HZstr,i,1))>160
       hz=SUBSTR(HZstr,i,2)
         C='Z'
           FOR j=1 TO 26
              IF  SUBSTRC(hz,1,1)                 C=CHR(95+j)
                EXIT
              ENDIF
           ENDFOR
       PYstr=PYstr+upper(C)
      i=i+1
   ELSE
       PYstr=PYstr+upper(SUBSTR(HZstr,i,1))
   ENDIF
ENDFOR
RETURN PYstr
ENDPROC

你可能感兴趣的:(ASP.NET三组件,ASP.NET组件,汉字转拼音首字)