写入下列代码放入程序chrtopinyin.prg中
LPARAMETERS cstring
LOCAL cpinyin,i,j,ctemp,cchr
cpinyin=""
SET COLLATE TO "PINYIN"
Pycode="八嚓咑妸发旮铪讥讥咔垃呣拿讴趴七呥仨他哇哇哇夕丫匝咗"
FOR i=1 TO LEN(cstring)
IF ASC(SUBSTR(cstring,i,1))>160 &&判断是否为汉字
Cchr=SUBSTR(cstring,i,2)
ctemp=""
FOR j=1 TO 26
IF SUBSTRC(cchr,1,1)
EXIT
ENDIF
ENDFOR
cpinyin=cpinyin+UPPER(ctemp)
i=i+1
ELSE
cpinyin=cpinyin+UPPER(SUBSTR(cstring,i,1))
ENDIF
ENDFOR
RETURN cpinyin
---------------------
调用即可如 chrtopinyin("你好")结果为 NH
上面代码是获取汉字首字符以方便查询的代码