解决网友如何在VFP中分离字母与数字字符串的问题
LcStr = "kkklfgfgj1jklll19kkkkjf888kll"
LnCount = Len(LcStr)
Clear
LcTmpStr = ''
M_flg1=IIF( Substr(LcStr,1,1)>='0' .and. Substr(LcStr,1,1)<='9',1,0)
LcTmpChr1 = Substr(LcStr,1,1)
For i=2 To LnCount
LcTmpChr = Substr(LcStr,i,1)
M_flg2=IIF( Substr(LcStr,i,1)>='0' .and. Substr(LcStr,i,1)<='9',1,0)
LcTmpStr =IIF(M_flg2=M_flg1,LcTmpStr+LcTmpChr, LcTmpStr+'_'+LcTmpChr)
M_flg1=M_flg2
ENDFOR
LcTmpStr=LcTmpChr1+LcTmpStr
? LcTmpStr
[解决办法]
lcStr="kkklfgfgj1jklll19kkkkjf888kll"
?Chrtran(lcStr,'0123456789','')&& 得出字母
?Chrtran(lcStr,Chrtran(lcStr,'0123456789',''),'')&& 得出数字