clear
css=" 1 2 4 3 5 7 8 942 6 47 3 9 4 0 0 1 2
" && 注:字串中必须有数字
store SPACE(0) to c1,c2
ns=1
create cursor A (a1 c(4)) && 只一个字段
create cursor B (b1 c(4))
SELE A
for n=1 to LEN(css)
if ASC(SUBSTR(css,n,1))>47 and ASC(SUBSTR(css,n,1))<58
insert into A (a1) values (IIF(VAL(SUBSTR(css,n,1))<5,"小","大"))
endif
endfor
go top
if EOF()
return
endif
c1=ALLTRIM(a1)
insert into B (B1) values (C1)
ns=1
sele A
skip
do while.not.eof()
c2=ALLTRIM(a1)
sele B
if c2=c1
czd="b"+ALLTRIM(STR(ns))
zd()
else
ns=ns+1
czd="b"+ALLTRIM(STR(ns))
alter table B add column &czd c(4)
go top
zd()
c1=c2
endif
sele A
skip
enddo
sele b
scan
scatter to k
ck=""
for t=1 to ns
ck=ck+k(t)
endfor
?ck
endscan
return
function zd
locate for LEN(ALLTRIM(&czd))=0
if EOF()
append blank
replace &czd with c2
else
replace &czd with c2
endif
endfunc