以下是引用TonyDeng在2012-3-9 13:15:29的发言:
这代码,楼主估计是难以理解loop的用法,先把程序变换成如下代码,应该好理解了,一样的效果:
function cc
para cstr
cresult=space(0)
for n=1 to len(allt(cstr))
c=substr(cstr,n,1)
if between(c,"A","Z") .or. between(c,"a","z")
cresult=cresult+chr(asc(c)+1)
endif
endfor
return cresult
endfunc function cc
para cstr
cresult=space(0)
for n=1 to len(allt(cstr))
c=substr(cstr,n,1)
if ISALPHA(C)
cresult=cresult+chr(asc(c)+1)
endif
endfor
return cresult
endfunc
这代码,楼主估计是难以理解loop的用法,先把程序变换成如下代码,应该好理解了,一样的效果:
function cc
para cstr
cresult=space(0)
for n=1 to len(allt(cstr))
c=substr(cstr,n,1)
if between(c,"A","Z") .or. between(c,"a","z")
cresult=cresult+chr(asc(c)+1)
endif
endfor
return cresult
endfunc function cc
para cstr
cresult=space(0)
for n=1 to len(allt(cstr))
c=substr(cstr,n,1)
if ISALPHA(C)
cresult=cresult+chr(asc(c)+1)
endif
endfor
return cresult
endfunc
坚守VFP最后的阵地