?CHRTRANC([ABCD,。EFG],[ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz],[ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz])
坚守VFP最后的阵地
*---生成全角、半角字母表:A~Z的ASC码为41921-41946,a~z的ASC码为41953-41978 CLEAR CREATE CURSOR LSB (全角 C(2),半角 C(1)) A=[AABBCCDDEEFFGGHHIIJJKKLLMMNNOOPPQQRRSSTTUUVVWWXXYYZZaabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz] FOR I=1 TO 104 IF MOD(I,2)=1 A1=SUBSTRC(A,I,1) ELSE A2=SUBSTRC(A,I,1) INSERT INTO LSB VALUES (A1,A2) ENDIF ENDFOR CREATE CURSOR TABNAME (T C(40),T1 C(40)) INSERT INTO TABNAME VALUES ([Fidelity(大连)商务服务有限公司],[]) INSERT INTO TABNAME VALUES ([FIL(大连)科技有限公司],[]) SCAN B=ALLTRIM(T) FOR I=1 TO LENC(B) IF BETWEEN(ASC(SUBSTRC(B,I,1)),41921,41946) OR BETWEEN(ASC(SUBSTRC(B,I,1)),41953,41978) SELECT 半角 FROM LSB WHERE 全角==SUBSTRC(B,I,1) INTO ARRAY BJ B=CHRTRANC(B,SUBSTRC(B,I,1),BJ) ENDIF ENDFOR SELECT TABNAME REPLACE T1 WITH B ENDSCAN BROWSE这样应该保险了吧
CLOSE ALL SET SAFETY OFF USE T1 SCAN ZZ="" FOR I=1 TO LENC(ALLTRIM(MC)) ASC_MC=ASC(SUBSTRC(MC,I,1)) IF BETWEEN(ASC_MC,41921,41946) OR ; BETWEEN(ASC_MC,41953,41978) ZZ=ZZ-CHR(ASC_MC-41856) &&减去全角字母和半角字母的ASCII码之差 ELSE ZZ=ZZ-SUBSTRC(MC,I,1) ENDIF NEXT REPLACE MC WITH ZZ ENDSCAN CLOSE ALL SET SAFETY ON